EDIT:
How can you redirect all non-active subdomains to 'www'?
Here I try to redirect all subdomains not listed to 'www'.. I can't make it work properly because %1 and %2 doesn't return anything.. Here I'm trying to redirect to google.com just to check the returned %2 value.., but it doesn't return anything and the redirect url is http://www.google.com/
RewriteCond %{HTTP_HOST} !^(admin|demo|www)\.([^\.]+\.[^\.]+)$ [NC]
RewriteRule ^(.*)$ http://www.google.com/%2 [L,R=301]
this is what I really want to do
RewriteCond %{HTTP_HOST} !^(admin|demo|www)\.([^\.]+\.[^\.]+)$ [NC]
RewriteRule ^(.*)$ http://www.%2/$1 [L,R=301]