The trick is that you don't need to encode the states into your 64 bit 'StateKey'. In fact... you definitely do NOT want to do that. Instead, you want the key to be able to lookup predefined/precreated states. The following should give you an idea although it's obviously not meant to be used directly
int rasterizerStateIndex : 8; // these would be appropriately sized based on the number of states you expect to encounter
int depthStencilStateIndex : 4;
StateKey GetStateKey(D3D11_DEPTH_STENCIL_DESC stencil, D3D11_RASTERIZER_DESC rast)
result.depthStencilStateIndex = FindDepthStencilStateInterfaceIndexByDesc(stencil);
result.rasterizerStateIndex = FindRasterizerStateInterfaceIndexByDesc(rast);
I hope this gives you the idea. You could obviously put whatever you want in your StateKey. Other things to add may be InputAssemblerIndex, RenderTargetsIndex, or even direct state such as a single bit for IsTransparent, or a few bits defining which render pass or full screen phase this entity should be rendered to.
The real point is to realize that the D3D state objects have a LOT of state in each one of them... but you'll never need every possible combination of those states. I think you'll find that you'll likely only have a few to a few dozen different items for each of the actual state objects.
I'm too tired to proof read this - hope it makes sense and more importantly, hope it helps.