The way that works most widely is <nobr>X-ray</nobr>. Despite not being part of any HTML spec, the nobr tag works well.
Nowadays, using the non-breaking hyphen U+2011 (suggested in other answers; you can also enter it directly, if you know how to do that in your editor and you are using UTF-8) works almost as widely. There are risks, however. Support to U+2011 is not universal in fonts. This means that unless you take special measures to use a font that contains it, or to use suitable backup fonts, it is quite possible that the non-breaking hyphen looks different from the normal hyphen (which is mostly the “Ascii hyphen” on web pages).
This means that foo-bar and foo‑bar (with non-breaking hyphen) may look different, since they come from different fonts. It might take a trained eye or a typographer to see the difference, but in some font combinations, the difference is clearly observable. 
Using nobr, you don’t have this problem, since the same character is used. The same applies to using <span style="white-space: nowrap">X-ray</span>, but it’s a bit clumsier and a little bit less reliable (does not work when CSS is disabled).