Here is the exemption concerning residency.
Citizens living abroad and certain noncitizens - You are:
- A U.S. citizen or a resident alien who was physically present in a foreign country or countries for at least 330 full days during any period of 12-consecutive months;
- A U.S. citizen who was a bona fide resident of a foreign country countries for an uninterrupted period which includes an entire tax year;
- A bona fide resident of a U.S. territory;
- A resident alien who was a citizen or national of a foreign country with which the U.S. has an income tax treaty with a nondiscrimination clause, and you were a bona fide resident of a foreign country for an uninterrupted period that includes an entire tax year;
- Not lawfully present in the U.S .and not a U.S. citizen, or U.S. national (for this purpose, an immigrant with Deferred Action for Childhood Arrivals (DACA) status is not considered lawfully present and therefore is eligible for this exemption.);
- A nonresident alien, including (1) a dual-status alien in the first year of U.S. residency and (2) a nonresident alien or dual-status alien who elects to file a joint return with a U.S. spouse; or
- An individual who files Form 1040-NR, U.S. Nonresident Alien Income Tax Return, or Form 1040-NR-EZ, U.S. Income Tax Return for Certain Nonresident Aliens with No Dependents, (including a dual-status tax return for your last year of U.S. residency) or you are claimed as a personal exemption on one of those forms.
If you meet one of these conditions, you qualify for this exemption even if you have a social security number.