Found some more efficient code, but still has same drawbacks.
Code:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
Works automatically for all domains with just those 2 lines; do not need to enumerate all 20 domains. But it still doesn't work for subdirectories, only works for the top level domain.com -->
www.domain.com.