With my PDs they have bitten me for 3 reasons:
1: When they were scared of me as a new owner
2: When they are being handled and they don't want to be
3: They give little exploratory nips
I've found the best way to deal with these are as follows:
1: Immediately make a loud nouse (no etc.) and place them in a dark box or bin. It should be tall enough so they can't jump out. Leave them there alone for 5-10 mins and then put them back in the cage. Isolation is something PDs are hate more than anything and will quickly teach them not to bite. Even now when my PDs gets agressive, I can put my finger in their mouths and they will move away; they know what would happen if they bit me.
2: Learn theid body language. PDs are very willfully animals and still only a few generations away from being wild. If they want to be put down, do it. If you fight it, you'll always get bitten.
3: Just give them a quick no and a tap on the nose. Physical pain just pisses prairie dogs off, but a quick tap just reminds them that thats something you don't want bitten. Whether it's you or your clothes.
I would never recommend any sort of pain reponse, prairie dogs do not respond well to it at all. It'll just make them trust you less.