Pidgin Privacy Please is a free add-on for Pidgin that stops IM spam in its tracks. It fools spammers who IM you by auto-responding as though you’re offline, or can be configured with an auto-response message that you choose. You can even add a kind of captcha to your auto-responses, where the person has to prove they’re human before the IM will reach you.
The add-on can also be configured to block messages from people not on your contact list entirely, or block messages that match a regular expression that you provide. It can even suppress repeated buddy authorisation requests. Pidgin Privacy Please is free and works where Pidgin does.