Great question! Of course it is, but be prepared to explain just in case you are asked why they weren’t invited in the first place.
If you have a legitimate reason for not inviting someone to the actual wedding, but would very much like them to attend your hen’s/buck’s night (ie. you are having an intimate family-only ceremony etc) tell them that.
Explain your reasons and they may very well understand, which is the best possible solution because nobody gets hurt; You have your friend in attendance on one of your truly special days and they don’t feel like they’ve been snubbed.
Related link: How do I tell someone they’re not invited to my wedding?