Redirecting unexisting subdomains to error page

I'm really having an issue with unexisting subdomains. For example, I have created the example.com domain with www. as auto-subdomain, but the problem is that if I go to 1029ur0pa.example.com it'll still open, just as www.example.com