If immigration lawyer is involved they can help you with this. Essentially, your spouse (or ex spouse at that time) will sign an affidavit / personal statement. This affidavit can be prepared by a lawyer after having a chat with spouse / ex spouse to confirm the facts.
It will contain history of how you guys met, married, how marriage went and potentially reasons why you split. In the statement the US citizen spouse / ex spouse will confirm that the marriage was bonafide and real, just didn't work out. E.g. they don't have objections for you staying in the US and getting 10 year GC.
This statement can help approving the case quicker and provide some protection in case if ex spouse later will write a mean letter to USCIS, accusing you of marrying them for green card or something like that.
Just make sure you're in good relationship with your spouse. It may be hard during divorce, but it helps if they're supporting you staying.
Either way, it's not wise to stay married for papers, as this can be seen as fraud.