Well with Yahoo Instant Messenger, yes there is a way to block a contact.
However, trying to block a text from an unwanted number was what I was trying to look up yesterday, even on the AT&T website forums....no prevail there is not an option for that under Text Messages Preferences....however for those who have Verizon. One word: Lucky!