How to remove/block virtually created sub domain from search engines

If he creates a robots.txt file and place it in the root of the subdomain, then add the code to direct the bots to stay away from the entire subdomain’s content.

User-agent: *
Disallow: /

I’m 100% sure that it has no chance to stay indexed.