This came while doing some work in a place where we couldn't use headphones, but could listen to music, every now and then we'd run across a song that wasn't... appropriate. First I added a rule to my Smart Playlist I was using (a general one that has the genres I list to most). In the first drop down menu, I changed "artist" to "Comment," then "Contains" to "Does not Contain," and finally, in the text box, I typed in "not work safe."
Next I saved the following script as an application (with no startup screen) in my user's Library -> iTunes -> Scripts (I called it 'iTunes Not Work Safe').
tell application "iTunes"
set newcomment to (comment of current track) & " Not Work Safe"
set (comment of current track) to newcomment
end tell
Now if I run into a song that isn't work safe, I click on the script menu in iTunes, and select iTunes Not Work Safe, and that song will be removed from the smart playlist.
Mac OS X Hints
http://hints.macworld.com/article.php?story=2004062423111294