Hello,
The warning you point out is thrown by PHP; some functions of PHP throw exceptions and others throw notice/warning/fatal messages that can't be catched using a try-catch block (https://stackoverflow.com/questions/7082401/avoid-domdocument-xml-warnings-in-php). If needed, you can register a custom error handler to get that messages and throw exceptions (https://stackoverflow.com/questions/1759069/php-domdocument-error-handling).
Anyway, phpdocx ignores placeholders that don't exist. You could get the placeholders from a template using the getTemplateVariables (https://www.phpdocx.com/api-documentation/templates/get-Word-template-variables) and compare the array this method returns to know if a placeholder exists, and then replace it or not.
But we think there must be an error on the template you are using. If you send to contact[at]phpdocx.com the most simple script and template that illustrates your issue the dev team will check it. The dev team needs to run it, so please avoid external connections, and send the smallest code to be able to test it.
Regards.