ssh is probably opening
/dev/tty, which is why adjusting filehandles beforehand doesn't help. One standard solution to the "program is opening terminal" problem is to use
Expect, which will create a new terminal for the program to read from. This is a good general solution to the problem.
Another possibility is to use OpenSSH's BatchMode option. The docs say:
If set to “yes”, passphrase/password querying will be disabled.
This option is useful in scripts and other batch jobs where no
user is present to supply the password. The argument must be
“yes” or “no”. The default is “no”.
which sounds like what you want. To use it from the command line, you would say something like:
ssh -o BatchMode=yes ...