I cannot answer your question precisely as I am a bit unsure of the exact issue. But I will warn you that if you turn over your house (deed in lieu) and do the bankruptcy and then there is a judgment set against you for the deficiency, that deficiency make come too late to be set aside in the bankruptcy, so timing is critical.
I would speak to a foreclosure defense attorney and a bankruptcy attorney before doing anything.
And I would assume that having a lien against you would affect your ability to borrow money for future real estate deals, as would a bankruptcy. Cash deals would, of course, be unaffected.
I think the best solution for your situation is to surrender the house in Chapter 7 bankruptcy, unless there are other factors that you haven't mentioned.
1) A deed in lieu generally does not happen if you surrender the house in BK. Deed-in-Lieu of foreclosure is rarely granted, and even then you still have to get the bank to waive their right to deficiency.
2) If you surrender the house in bankruptcy, all of your obligations for that house get discharged. Afterwards, the bank is supposed to resume the foreclosure proceeding at foreclose the house. Be careful here. Make sure they actually do foreclose shortly after your bankruptcy discharge. If the lender drags their leg taking forever to foreclose, you may still be on the hook if a neighborhood child trespasses your property and gets injured. If the lender drags their leg taking forever to foreclose, you will definitely be on the hook for condo association fees that accrue after the date of your bankruptcy petition.
3) Motions to Avoid Liens are for a different scenario.
4) At this point, anything will affect your ability to buy another house including bankruptcy. But after a bankruptcy discharge, you are at a fresh start. No past judgments, no past debts, etc. You can then re-build your credit history immediately after your bankruptcy discharge and eventually buy a house. The best way to rebuild your credit history is to use a "secured" credit card. See the below wikipedia link about secured credit cards - http://en.wikipedia.org/wiki/Secured_credit_card#Secured_credit_cards