Seems like you're trying to start rewriting without loading the modules. This sort of thing is generally better to configure in a VirtualHost at any rate, as you're mapping a rewrite for a certain site. The error you get basically just means you have a syntax error.
<VirtualHost *:80>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
</VirtualHost>