Bankruptcy Law Questions? Ask a Bankruptcy Lawyer.
You do have a homestead exemption that allows you to keep your house during bankruptcy. However, this exemption does not prevent the lender from foreclosing on the home if you default on the note. The lender will request that the automatic stay be lifted against it's lien, and when this is allowed, the lender will proceed with foreclosure.
You can certainly offer to re-negotiate and re-affirm the debt after you file bankruptcy, but the bank is not required to allow you to do this. It can refuse and foreclose.