We have performed spectrally resolved x-ray scattering measurements on highly compressed polystyrene at pressures of several tens of TPa (100 Mbar) created by spherically convergent shocks at the National Ignition Facility. Scattering data of line radiation at 9.0 keV were recorded from the dense plasma shortly after shock coalescence. Accounting for spatial gradients, opacity effects, and source broadening, we demonstrate the sensitivity of the elastic scattering component to carbon K-shell ionization while at the same time constraining the temperature of the dense plasma. For six times compressed polystyrene, we find an average temperature of 86 eV and carbon ionization state of 4.9, indicating that widely used ionization models need revision in order to be suitable for the extreme states of matter tested in our experiment.