I'm going to refuse to dance at family gatherings/parties/wherever
Do you have a reason why you don't want to dance?
I don't like dancing because it has bad consequences for my knees.
That sounds like a pretty good reason not to dance!  If it makes you uncomfortable or hurts, you shouldn't do something.  I'm sure your family will understand!
I hate dancing and I hate family functions. If they start dancing I will smash the speakers.
It sounds like people want to have a good time and you should try your best to enjoy yourself without having to dance. You can make your own decisions and no one can force you to dance. Why not instead act busy by taking photos of them dancing?