I think it's important to distinguish between hitting on and being friendly. Sometimes guys are just being friendly, but then there comes a point where suddenly I get red lights flashing and can see the request for a date coming . . . and sure enough, there it is. Here are some of my strategies.
Be polite but not encouraging. Like when I was keeping a friend company while she was moving, the mover wanted to talk to me. I would use clipped answers to a question so I'd be polite, but not reciprocate any interest in getting to know him. But sometimes that doesn't work, and I have a bad habit of being really friendly, so . . . .
Try wearing a fake wedding ring or engagement ring. I have one that cost me about $8. I don't much like wearing rings so I only wear mine if I am going somewhere I expect to get hit on. But when I have it, I can put it where it is very visible. For example, if some guy is seeming flirtatious, I can nonchalantly hold it up near my face where it can be seen, like by covering my mouth briefly, putting hand to lip, or any number of other gestures that look fairly natural, but make the ring unmistakably visible. But sometimes that does not dissuade, so . . . .
Assess the situation and deal with it as safely as possible. In the case of helping my friend move, I was checking the closets at the back of the apartment to make sure nothing was forgotten when the mover came into the room, stood between me and the door, and asked me for a date. He wanted me to call him, oddly enough. So I just graciously took his phone number, commented on how sweet it was, and left him feeling good so he wouldn't do anything to me while everyone else was busy outside . . . and then I threw it away after I left. Oh yes, and I did let my friend know what had happened as soon as she came back in.
Unfortunately, I don't know any women (trans* or cis) who have found a really good solution to unwanted male attention. And it can be a safety issue. I was, until my national rating went inactive, one of the top ten female chess players in Maryland. I've had to stop going to my local chess club because of a guy who is very persistent in asking me for dates and started cyberstalking me. For a while he friended me on Facebook and I let him. It didn't last long because every time I posted anything, he'd respond by posting his fantasies about me being over at his house cooking for him and us watching the snow fall together and all sorts of other stuff. It got to the point where I feel like going back to play chess at the club near me would be either highly awkward or maybe even unsafe. Neither of those options is appealing.
Unfortunately, this is part of what women have to navigate and finding good solutions to it is tough.
Kudos to the OP for raising the topic. This has been a tough one for me to talk about in the trans* community because it is usually not taken seriously as an issue/problem/concern. The usual reaction has been for people to say that they wish it would happen to them, so they can't imagine it being a problem. So for all those who may be thinking that . . . Be careful what you wish for because you just might get it.