It depends on what kind of message it is (true SMS or something else like an e-mail sent to your text e-mail address
xxxxxxxxxx@txt.att.net).
Besides AT&T's paid services, you can go (at no charge) to
http://mymessages.wireless.att.com and set up your blocking options for e-mail messages sent to your phone's text address. You can block different types of e-mails, create white and black lists, and create an alias.
So... I blocked e-mails to my mobile text address, I created a white list for work, family, etc., blacklisted mblox.com, and created an alias (MyAlias@txt.att.net) in case I want to get something quickly without changing my settings.
True SMS messages that come from a short number can be blocked, but SMS messages that come from an actual 10 digit phone number cannot be blocked without purchasing AT&T's premium services.
The inability to block all texts and phone calls without purchasing premium services is inexcusable. OT: I subscribed to TrapCall for $5 / month to get Blocked phone numbers shown (while I was getting prank calls) and it also allows you to block calls.