Responding to Inappropriate Comments
"Your body looks great in that dress/top/etc."
Say: "I'm sorry, my body?"
Act as if you are sure there's some innocent meaning in there, but you're having trouble figuring that out. Look them right in the eyes, then as you say "I'm sorry," pull your head back a bit almost imperceptibly as if taken aback. Then, as you raise your eyebrows and turn your head slightly to the side, say the second part. You speak without challenge or any negative attitude, with no internal feeling of having a chip on your shoulder. Keep in mind that the situation is your opponent, not the person. Speak in a confident, not annoyed, not angry, calm tone, perhaps more of a skeptical, questioning, puzzled one. Whatever you get back, pick one to three words from their reply and say "I'm sorry, x y z?". The words you pick should be ones that when dug into, are spoken aloud, and they are forced to think about having said, will embarrass the dickens out of them. Try not to pick words that indicate great interest in them.
Or say: "I'm sorry, how am I supposed to take this?" Your meaning is "please explain to me what meaning you intend me to take from this." Whatever he says, just keep saying "I'm sorry, you are just giving me a compliment?" or maybe "I'm sorry, you're giving me a compliment about my body?".
(None of these movement instructions are hard and fast. Do it in your own way. Your body motions are less to convince him than to convince yourself that you really mean it. Your raised eyebrows help you feel that mild surprise instead of anger. And so on.)
You are using a form of active listening that also borders on meta-modeling. It is slightly less hostile than blatant meta-modeling, and does a better job of keeping the person talking, but has many of the same benefits of forcing him to think about what he has just said and giving him the opportunity to realize how stupid and offensive he sounds.
"I'd take you for dinner and a show if I didn't have to worry about my wife finding out"
Say "I'm sorry, your wife?" like the fact he has a wife is of greatly amazing interest to you (as it should be to him, stopping him from saying these kinds of things to you). Or "I'm sorry, dinner and a show?!?" with a little bit of an incredulous tone, like you are seriously not sure how he could be saying what he's saying.
The wife is a good one. Keep digging into the person's wife. Get him talking all about her. Soon he will find that he has spilled so much about his dysfunctional relationship with his wife that he won't have much steam left for suggesting he's hot stuff to you.
Additional Strategies
You can also try some of the following things:
"How am I supposed to be comfortable working here if you keep saying these things?"
"How are we supposed to have a professional relationship if you keep saying overly personal things like this?"
"How am I supposed to get any work done when you keep interrupting me?"
"What kind of relationship are you imagining with someone who has only professional goals in mind at work?"
"You have made a very tempting offer for someone looking to date an older married man at work, but, how am I supposed to respond positively when I already have a boyfriend my age outside of work?"
Whatever he says, you don't get ruffled. You don't become afraid you've blown it. You don't answer any of his questions. You don't roll with his suggestions or explain yourself. You just keep reflecting back to him, over and over. "I'm sorry, but ..." and "How/What" questions. Make sure the how/what questions are open-ended. Don't ask questions that have possible-single-word answers that can be "yes" or "no" or "tomorrow."
Also, Important
If he starts talking, let him. Don't say more than you need to. You say the 2 or 3 words, or you say the variant of "How am I supposed to x", and then you be quiet and let him talk. Don't answer questions immediately. Look at him for the count of 5 before talking. Make him squirm by looking directly at him without him having a hint of what you're thinking. His thoughts will turn to himself and he'll become very uncomfortable.
Why
Your goal is to either get the person to shut up or to get him to say something so incredibly over the top that it's absolutely clear harassment that you will immediately take to HR.
He might shut up because he starts thinking about your situation and how exactly you are supposed to respond to the crass and inappropriate comments like he is making. He might shut up when he realizes that you truly aren't interested, you have a mind, you are firm and know what you want, and you handle the situation coolly and calmly, and he has no chance. He might shut up because he gets embarrassed about having discussed his wife so much with the person he's trying to hit on. He might shut up because he realizes he's crossed a big line and is afraid he'll get in trouble.
Practice it
Practice this with a friend until you have it down cold. Make the friend come up and harass you, and you use these techniques. If you're struggling or feel like it's not realistic enough, have a friend get one of his friends that you don't know to "pull a prank" on you, and in a safe public place come up and harass you in exactly one of these ways. Your friend tells the friendly pranker to try to get you to go out with him, and he has to pretend to be your coworker. But the pranker is told to give up if you do a good job or after 2 minutes (say). You get the idea—the confidence and calmness that you learn is the most important part. Your practice gains you that confidence because it's not new and threatening any more.
Source
I think you would greatly benefit from the book Never Split the Difference: Negotiating as if Your Life Depended on It by Chris Voss, which I got most of these ideas from. It is by a former FBI hostage negotiator who learned these strategies and others which would undoubtedly be of use to you.
As the author says in the book, a hostage negotiator has to get all of the hostages out alive, has to pay little or nothing on the ransom demands, and has to get the hostage-taker to feel like the negotiator is a friend and like him, and give himself up. Given that strategies to actually accomplish this in the majority of the situations exist, and actually work, I'm sure you can imagine how having a direct line on those techniques and using them on your inappropriate coworkers could work wonders.