I am often asked by potential clients whether they should file a single bankruptcy or file jointly with another person. First of all, anyone can file single even if they are married. However in order to file jointly with another person, you must be married to that person on the date of filing. It doesn't matter if the marital status changes after filing.
Next, we must look at who is liable for what debt. If only one party has a significant amount of debt, we might want to consider filing singly in order to keep the bankruptcy filing off the credit record of the other party. However one thing to keep in mind is that if one party files bankruptcy, especially Chapter 7, they do nothing to protect the non-filing party from their own creditors or any debt that both the filing and non-filing party may be liable for. There are ways to protect a non-filer with a Chapter 13, but that can often become expensive because it will usually require the filing party to pay the entire debt in order to protect the non-filing party. If both parties have significant debt, it is probably best to do a joint filing.
You should consult a competant attorney in your jurisdiction to discuss whether to file jointly or singly.