Hmmm, kill all subdomains? Why have them at all then?
Oh, well, test for existance of subdomain which is NOT www then redirect to the www’d version with %{REQUEST_URI} and let the %{QUERY_STRING} be passed automatically (as it will be unless you create a new query string).
If someone linked to xxx.mydomain.com, it would FAIL if xxx was not a registered subdomain. Subdomains are treated the same as a domain so, if it’s not registered with your DNS, you won’t ever see the request.
… and .htaccess has nothing to do with DNS, only Apache.