Am I obligated to work on a project unrelated to my thesis because PI asked me to?
I don't know the details of your situation, but you should keep in mind my personal rule #1 of academic research:


  Rule #1. You should always have a publication in mind for research you work on, unless there is some other very tangible benefit that makes it worth the time. 


This rule is motivated by the fact that your vita showcases the publications you produce (and the grants you receive), but not the projects you work on. You want to make sure that you get due recognition for your efforts, which means turning them into publications. The more often you can employ rule #1, the better. 

Are you certain that you cannot find a way to get a publication out of this project, perhaps by broadening it slightly? 

The second thing to keep in mind is that, in a group research lab, it is very reasonable to do some work that is not related to your thesis. Of course, you must also work on your thesis, but it does not need to be the only thing you do. Having a more broad vita when you graduate is a real benefit if you are applying to postdocs and other positions. 

Finally, are you getting paid out of the PIs grants? If so, that is perhaps a more tangible reason to work on the projects that fund those grants.