It's pretty simple. You point password_file at a file containing the password; and you use Unix permissions to ensure that this file is readable only by the prometheus process (i.e. the userid that prometheus runs as).
If you are using Kubernetes, it has the ability to expose "secrets" at a specific path in the filesystem, so you could point to one of those.
Certainly, if someone breaks into the system as 'root' or the prometheus user, they'll be able to read the secret. But that's pretty much a requirement, since the prometheus process itself needs to know the secret.