As an undergrad, is it unethical to work in a field that I'm not interested in pursuing further in graduate school?
It is definitely not unethical. Many undergraduates interested in medical careers do research in, say, biology labs, since it looks good on their applications. It is common practice in the field, and no one considers it abusive. 

More importantly, oftentimes people take up RA positions specifically for a purpose like yours: to figure out whether or not graduate school is right for them and, if it is, whether they want to stay in the same area or switch to a different one. Being an RA is one of the best ways to try out a particular line of research  without a long-term commitment. That said, once you decide that you want to pursue research in a different area during grad school, it definitely doesn't mean that you should immediately resign (especially since you are planning to publish your work). Even though you are not planning to stay, you can still make a contribution!