From the HR training i got from many places, harassment is what gets you in trouble with HR i.e. persisting after your advances have been rejected. Politely shooting your shot is fine, unless the target reports to you.
You're missing the distinction. I met my wife at work but any and all propositioning happened outside the office, and not at office social events either.
You can invite a group of coworkers to an event. You can attend events established by groups of coworkers. You can invite an individual to a party you're hosting that other people are attending, or sometime when she didn't pack lunch you can offer to go grab lunch with her. The important thing is to establish a social relationship before trying for a romantic or sexual one: Don't single her out, don't ask her to be in a situation where it's just you and her in something heavily date-coded (keeping her company when she grabs lunch? good! Asking her out solo for drinks/dinner? bad!) until you're a known quantity to her, until you could confidently say she considers you, if not a friend, someone she's friendly with. At that point, and AT THAT POINT ONLY, you can casually, in a low-key way, ask her on a date in a way that makes it abundantly clear it's not going to be a huge deal if she says no, and that that wasn't the whole entire point of getting to know her.
And one way to make it clear (to her and to yourself) is to have (social) relationships with other coworkers, with other women, and to have other women in your life. That way she knows (and you know) that she's not your sole focus, your only real chance, and she knows that you're able to maintain healthy, safe relationships with women that you aren't trying to date.
The really important thing is to make sure she understands that there's no pressure on her to say yes, and that saying no will not lead to an uncomfortable workplace dynamic. A lot of this is good advice for connecting with women you'd potentially like to date in other circumstances too - the reason there's a lot of generic, overly broad 'advice' floating around about "don't hit on women at the gym" "don't flirt with women at their place of work" "don't ask women out at school" "don't ask your friends out" "don't hit on women in hobby groups" is that a lot of men are terrible at not making women feel singled out and socially coerced. If you can convince yourself that you're in that situation for more reasons than looking for a date, and if you're able to create a broader social context, you're very unlikely to fall into that trap, and vastly less likely to get accused of behaving inappropriately; and if you somehow do anyway, it'll be much easier to defend yourself as having engaged in good faith. Since you obviously did.
Uh, only if invited? I mean do you not ever get lunch with coworkers or invite them to events you're hosting or ask if they want to see a movie or concert with you that you've been into? The important thing is to establish a positive social relationship before indicating any sort of sexual interest, so they know you as "My chill coworker John" rather than "John the guy at the office who's always staring at my tits and asked me out for 'drinks' before we ever had a single conversation." It's not impossible to establish sexual or romantic chemistry before establishing social chemistry, but it's sure harder.
I was wondering if someone would jump on that. Are you genuinely curious about or unclear on the difference? Do you legitimately not understand how those two statements can be true? I'm willing to try to explain, if you're seriously interested, but if you're motivated by trying to demonstrate that I'm incorrect I won't waste my time.