Sorted it out. Posting here in case anybody else has the same problem.
I copied /var/cpanel/templates/apache2/main.default to /var/cpanel/templates/apache2/main.local and edited the new copy, main.local.
I found the following lines.
After these lines, I added the following, replacing myip with the dedicated IP address and /some/folder with a nonexistent folder (as I want a 404 if anyone access the site other than through the proper domain name):
[%- FOREACH nvh IN namevirtualhosts -%]
NameVirtualHost [% nvh %]
[% END -%]
I then ran the following commands to rebuild the apache config and restart the server.
Seems to work, though it seems a shame to have to copy the main template to do something so simple. Perhaps someone knows a better way...?