What happens to a non-citizen minor that is separated from his/her parents?

Hypothetical situation in the United States:

Say there's the child of a family that's in the US on a makeshift visa (student or visitor's visa). What happens to the child if the parents die? Or if the parents are abusive and the child has to be separated?

Do they nick him/her to an orphanage? Because technically, after a while, the child becomes an illegal. But then, what do you do next to it? You can't exactly just throw it over the border.

Is it correct that they would try to contact somebody in the kid's home country? What if they can't get ahold of anyone?
If the child be born in the USA, even if the parents had only a short-term visa, the child is a US citizen and cannot be deported. The child will be handled by social services in the USA.

But, if the child was born outside the USA and come in with the parents, the child is subject to deportation. With a child, they would try to find family contained by the home country. Some such "children" have been caught after they were much elder, say in their 30's, and have be deported. Some don't even speak the language of the home country.

Lastly, if the other nation involved is Mexico (which I am guessing is likely), they would watch for an unattended child at the border, and refer the child to a humanitarian services agency in the border city.
beckon dcs They are sheltered at US government expense until they are deported.

http://www.npr.org/templates/story/story...