See what you think of this:
simulate this circuit – Schematic created using CircuitLab
It's inverting, but that's easily fixed by bitwise-inverting the ADC reading (yes, that works!), possibly by using an instruction just for that instead of the normal load instruction or whatever your MCU uses. So no performance penalty at all if you can convince your compiler to do it that way.
Having made the inversion problem irrelevant, we can look at how it actually works. It's essentially an inverting amp, but with the reference chosen explicitly. Grounding that reference is only a special case; it could be anything within the opamp's acceptable range, and forms a sort-of "pivot" around that voltage. When the input is equal to that, so is the output, and the inversion happens relative to that point.
So:
- You want a gain of magnitude 1, so R3 = R4.
- Now, with that gain fixed, what does V_ref need to be to give you the right output range? Pick an operating point that's easy to calculate, and then check it for a few other points if you like. When you're satisfied, figure out what R1 and R2 need to be to make that reference voltage.
The opamp never sees the raw input voltage that is beyond its own rails. It only sees the reference, x2 because it's actively maintaining the other one, and its own output.
The catch though, is that it doesn't produce the reading you want when the input is disconnected. It produces the reference instead. I can't think of a good way to accomplish the desired default behavior without adding a negative rail.
If that's all it's doing though, and it's really that important, then it might be worth adding a charge pump or low-power DC-DC converter of some kind to produce that negative rail. Then there are several easy ways to accomplish your goal.
However, if you only want to "detect a disconnection" and do something special in that case, then you could simply add a resistor to pull VIN up to V+, and perhaps fudge the gain and reference a bit so that a "normal" signal never causes 0V to the ADC, while the uncontested pull-up does. Then write a special check for that into your software.