Consider deed-in-lieu before a foreclosure, but a Short sale for sure.
What are the pros and cons of a deed-in-lieu and foreclosure?
A deed-in-lieu is where you give the deed to your house to your lender and the lender does not foreclose. Thus, the concept "in lieu," meaning "instead of."
The pros of a deed-in-lieu include unloading your property with little hassle; not having to suffer the embarrassment of having the sheriff hold a foreclosure auction right on your front porch (which is the practice in many parts of the country); and you can reach agreement with your lender in advance as to how much money (if any) you will have to pay the lender.
In many deed-in-lieu arrangements, while the lender will agree to take the house back and cancel your loan, sometimes it comes at a cost, i.e., you will have to pay something for this. Compare this to a foreclosure, where you won't know what the house will sell for, and in many states, like New Mexico, you can be sued for the difference between what you owe and what the house sold for (called a deficiency judgment).
One more positive: Congress just extended the "forgiveness of debt" law for 2013, so in many situations you will not have to pay tax on the debt that was forgiven when the lender took the deed-in-lieu.
Compared to a foreclosure, I cannot think of any negatives by doing a deed-in-lieu. However, if a short sale is at all possible, I would opt to go that route instead of giving the deed to your lender. But whether you lose your house by way of a foreclosure or a deed-in-lieu, or enter into a short sale, your credit will be impacted.