It appears that the username and password fields are related to creating a new user account, perhaps something that a system admin would do when setting up a new user (as opposed to a user doing it for their own account).
With this is mind, I would suggest making that part of the form a more explicit action. Only show those fields when they are required to be used.
For example, the form could initially look like this:
This way if the user only wants to specify the domain name, then they can fill that field in and submit the form.
If the user also wants to create a new user account, they can check the option to do that and then the additional fields can be shown.
At this point they will be required fields. This makes the validation message more simple, as those fields are never shown as optional. So you could just say:
The username and password fields are required when creating a new account.