what is the best strategy to deal with female co-workers?

i tried being nice to them, tried setting boundaries, tried avoiding them altogether, but at every job i've had i couldn't quite figure out how to deal with them - there's always something. right now i'm working in healthcare and i'm surrounded by ugly land-whales with piercings and tattoos, and a stinky attitude. how it goes is: they either try to boss me around (they're not my higher-ups, they have the same position as me) or they try to flirt with me. when i shoot that shit down, they try to destroy my reputation.

what's interesting is that i've never had this happen with: a) female supervisors, and b) actually good-looking women. both are usually nice or at least neutral.

ps: those women bossing me around - they're not better than me at the job, 9 time out of 10 i'm better at the job than them, and 1/10 we're equal. it's like they believe i'm their slave based on the fact that i have and a cock and balls.