Tax residence and legal residence are two different things.
"You will be considered a United States resident for tax purposes if you meet the substantial presence test for the calendar year. To meet this test, you must be physically present in the United States (U.S.) on at least:
31 days during the current year, and
183 days during the 3-year period that includes the current year and the 2 years immediately before that, counting:
All the days you were present in the current year, and
1/3 of the days you were present in the first year before the current year, and
1/6 of the days you were present in the second year before the current year."
As a spouse of a US citizen, you actually have the option to be treated by IRS as a US tax resident, regardless of your immigration status in USCIS records and regardless of your US physical presence. Even those spouses who have never set foot on US soil may choose to be treated as a US resident for tax purposes. W9 would be the correct form in your case.
More info here -- https://www.irs.gov/individuals/international-taxpayers/nonresident-spouse