What you are trying to do sounds like a wildcard DNS record. Unfortunately, I don't think DreamHost allows you to do this on a shared server.
Here is a quote from the wiki article on the subject;
[color=#0000CC]"Wildcards... in general, we will not add wildcard DNS records for you on a shared hosting account. This is for a number of reasons. If you have a special request, we'll consider it, provided you truly understand all of the implications of doing this."[/color]
Save [color=#CC0000][b]$50[/b][/color] on DreamHost hosting using promo code [color=#CC0000][b]SAVEMONEY[/b][/color] ( Click for promo code details )