Hi
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.

Dave