Please see this answer from IreneS.
You will have to file:
- a nonresident return for Arizona; and
- a resident return for New Mexico.
You are subject to Arizona income tax on all income derived from Arizona sources. Since you work in AZ you have to file a return there.
Because you live in New Mexico, you have to file a return there. However, NM gives a credit for taxes paid to other states by New Mexico residents.
IMPORTANT: Prepare your nonresident state (AZ) first so that the taxes paid to AZ flow properly to the NM return to calculate the credit.