When you file Form 1040-NR U.S. Nonresident Alien Income Tax Return, you cannot file jointly with your spouse. There is only one exception to this rule outlined as follows:
Per IRS Publication 519 U.S. Tax Guide for Aliens, on page 54:
I am a nonresident alien. Can I file a joint return with my spouse?
Generally, you cannot file as married filing jointly if either spouse was a nonresident alien at any time during the tax year.
However, nonresident aliens married to U.S. citizens or residents can choose to be treated as U.S. residents and file joint returns. For more information on this choice, see Nonresident Spouse Treated as a Resident in chapter 1.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the document at the time it is accessed.