For jokes I don't want to participate in, I usually respond with "Oh I've heard that one before" with a smile, instead of whatever response they're looking for. The smile implies I thought the joke was funny (and therefore so is the teller) and the words don't commit me to hearing it out.
I've been finding myself in a similar situation, not jokes but in the vein of conversations I don't want to play along with.
One of my coworkers has a (bad) habit of pushing the envelope of appropriate workplace conversation and when he senses the mood of the audience has turned against him, he typically wants to have an immediate private conversation with me or another coworker to kind of clear the air, or make himself feel better. Well, I usually don't want to have that side conversation or be the one to have to nod and agree that yes, he went too far but it's okay, really. No, it's not okay and I don't want to validate his choice to be obnoxious.
So if he signals me that he wants to have an aside, I just shake my head and quietly say "not now."