From the sounds of the error, foo.sh doesn't exist on server, so it fails.
The simplest solution seems to be:
ssh user@server 'foo.sh bar baz', provided "foo.sh" exists on the server.
If "foo.sh" doesn't/can't exist on the server, have you tried using here docs? For example:
ssh user@server "cat > foo.sh && chmod u+x foo.sh && ./foo.sh bar baz" << "EOF"
`heredoc> #Put your contents of foo.sh here
`heredoc> #And put them here
`heredoc> echo "Argument 1: $1"
`heredoc> echo "Argument 2: $2"
`heredoc> EOF
user@server's password:
Argument 1: bar
Argument 2: baz
EDIT:
david@localhost ~ % bash -s < test.sh David Finder
Hello David
Hello Finder
Edit to my previous answer, the issue is due to the quoting of the input arguments thrown to Bash, as it sees the entire input as one file (it's looking for a file literally called "foo.sh bar baz", with spaces within.