I was investigating the security of keyfiles vs passwords and thinking that possibly the keyfile could bypass keyloggers that might be installed on my machine.
Depending on what malware is installed on your system, like you said key loggers will log your master key back to the attacker but if an attacker wanted to gain access to your password database then he will just install a more sophisticated piece of malware to download your key file.
Matthew1471 is absolutely right. I think that law will always be true. To prove it, here is an article that details exactly how to crack the keypass storage to obtain passwords. https://cqureacademy.com/blog/windows-internals/safe-store-password-keepass-browser Still, using a solution like Keypass, Lastpass, onepass or any other (that is good) is a much better risk to take than falling back to using the same password across all systems.