This frequently happens to me and usually I answer something of the sort of:
Thank you for thinking of me, but I am happy in my current workplace and am not considering changing my job in the foreseeable future.
I think this answer is in no way offensive and will definitely leave the opportunity to reconsider in future. At the same time it is firm enough so that they don't bother you for a while (in my experience about 6 months to 1 year).