You have the wrong order... immediately after "RewriteRule" is the form of the URL that you want (ie. your clean url), with the Regex for whatever may change in that url. After that, you have the path of the URL, plus the Regex tokens for the found values (ie. $1, $2, etc.)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
ErrorDocument 400 http://www.domain.com/400
ErrorDocument 403 http://www.domain.com/403
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 500 http://www.domain.com/500
RewriteEngine on
RewriteBase /
#PAGES
RewriteRule ^/company/([A-Z]+)([0-9]+)/$ company.php?test=$1&%{QUERY_STRING} [NC,L]