If I had to guess, you are getting the "overlapping virtual hosts" error because you are putting a name in the virtualhost tag line. To do what you are trying to do (assuming you have DNS pointing both your URLS to the same server), you would have the following in your httpd.conf file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin
webmaster@domain.com
DocumentRoot /var/www.domain.com/
ServerName
www.domain.com
ErrorLog logs/www.domain.com-error_log
CustomLog logs/www.domain.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin
webmaster@foo.domain.com
DocumentRoot /var/foo.domain.com/
ServerName foo.domain.com
ErrorLog logs/foo.domain.com-error_log
CustomLog logs/foo.domain.com-access_log common
</VirtualHost>