Hi - my name is XXXXX XXXXX I'm a Bankruptcy litigation attorney. Thanks for your question.
Unfortunately, you are legally responsible for your HOA dues UNTIL the property is foreclosed by the lender because the property is still technically/legally owned by you until the foreclosure sale occurs. Thus, you are responsible for the HOA fees.
The property taxes are a little different because taxes are assessed against the property and not against you individually. So, if the property taxes aren't paid, the county/city will sell the property for the taxes due in a land sale. The county/city will not sue you for the debt - - instead, the property stands to be sold in order to generate enough money to satisfy the taxes. Thus, you don't have to worry so much about the taxes, and the lender will USUALLY pay the taxes to prevent someone else from coming in and claiming an interest/lien on it's collateral.
The best way to avoid having to continue paying the HOA dues is to offer the lender a deed in lieu of foreclosure, which is actually when the property transferred peacefully back to the lender via deed. This transfers title and puts the lender on the hook for the fees since it's the new owner.
Otherwise, you will be on the hook for the fees, and the HOA can sue you if you don't pay - - which could make the need to file bankruptcy a reality.
The best thing is to offer the lender a deed in lieu and see if it is interested in taking it.