We did this. My DH wanted to know so he found out when I was out of the room at our 12 week scan. He kept the secret the whole pregnancy.
Only issue was that we didn't really discuss names as if he was really pressuring for a particular gender I would know.
As it turns out I was adamant we were having a boy through the whole pregnancy but we ended up with a girl.