This thankfully hasn't happened to me for a few years but I always pretend to be hard of hearing or that there was a noise just when they said it, and try and make them repeat it. No one ever wants to repeat it, but you can't be "blamed" for being an awkward sod because you're "just" asking what they said.
Sorry? No, I didn't hear you, what did you say? No, really, I'm sure you said something, what did you say? Oh come on, I'm sure it isn't something bad, what did you say?
All with a broad smile and usually loud enough for anyone nearby to hear. The one time someone did repeat it I went "Oh!!!!!" As if really startled, and then they got flustered.
I used to work in a car factory and used this hard of hearing approach a lot. It helps not being English by origin because I could also ask them in my broadest forrin accent to explain sexist jokes to me slooooowly. And over and over. "I don't understand, please tell me, I do want to share the joke, please explain to me one more time, how do you know she is on her period and that means...what again?" etc.