Why not just using rel="nofollow"? That's exactly what it is used for.

Quote from Google (http://googleblog.blogspot.ch/2005/01/preventing-comment-spam.html):

"When Google sees the attribute (rel="nofollow") on hyperlinks, those links won't get any credit when we rank websites in our search results.