Your browser would normally make a dns query for the domain and then would know through an A record which ip the site would be served from and then the server would serve the correct site depending on the header information sent.
Most computers are capable of bypassing the dns query if it already knows the correct ip. You can normally do this by editing the host file on your client computer.
In most windows editions you can normally find the hosts file in:
There are normally examples in this file that are commented out.
Just add your own entry and save the file.
The browser will differentiate between the subdomain of www or without.
This is a good method if you have access to the computer you want to preview from but not so good to explain to a client or otherwise.
There are other more complicated methods.