State tax filing

My company is based in Phoenix Az but all the job sites I physically worked on are in NM, which is the state where I live. How can I get the taxes AZ withheld back? Why can they do that in the first place? I have never even been to the company headquarters in AZ.