This has annoyed me for years but I've never found a solution. Instead of pressing Esc then :x to save an exit from vi, I accidentally type a capital X and press Enter. The only way to continue is to allow encryption. Surely there's a cancel command at this point?
Simpler: cancel the operation by pressing escape
By canceling, you are ensured that the program will not do something unexpected with the prompted (empty) passwords.