The hex value is just a way of expressing RGB (or CMYK) values in base 16 i.e. 00 to FF instead of 0-255.
However an RGB (or CMYK) value without an associated color space (which tells a color managed application what real world color that value represents) is meaningless.
So the same Hex RGB(or CMYK) value can represent two different colors in two different color spaces.
Similarly, the same real world color can be represented by two different Hex RGB (or CMYK) numbers in two different color spaces.
Common document color spaces are sRGB, Adobe RGB, ProPhoto and similarly a number of differing CMYK spaces.
The most likely explaination for the symptoms you see are that the documents have differing color spaces (described by their color profiles) Go to the bottom of the Photoshop window and choose Document Profile to see the space each document is using.
Numerical values mean nothing until they refer to a specific color space (sRGB, Adobe RGB etc). The color space is what defines the numbers as a certain color.
A given set of RGB numbers will produce different colors in different color spaces.
Hex is just a different (and outdated) notation for RGB numbers. They are the same thing. But traditionally, hex refers to sRGB.
EDIT: Dave beat me. Trust me, he's dead right...
Thanks Dave and D Fosse! I appreciate it.