Since you were physically present working in New Mexico, you could file a Non-Resident return there and claim your exemption.
Here's more info from New Mexico Taxation.
Prepare your NM return first, then your Arizona Resident.
How to File a Non-Resident State Return
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"