I using LM4871 as a audio pre-amp in my device. If I let the output to earphones or external speakers then it works great. If I want to loop LM4871 output (pin 5 and 8) back to one of the local audio inputs then I have a problem. LM4871 output is not referenced to ground (looked with oscilloscope), but my other inputs are. How should I solve that? Here's the LM4871 application circuit I'm using:
It's hard to tell what you are asking because some things you say don't make sense. In the schematic you show, both outputs are clearly referenced to ground. Pin 5 produces the inverted signal and pin 8 the non-inverted, but both are referenced to ground. The DC offset of both will be close to half the supply voltage.
However, if the point of this block is to be a preamp, then the choice of this part makes no sense. You didn't supply a link to the datasheet so I don't know what a LM4871 is exactly, but from the schematic you show it appears to be a small power amp. You can see that the gain of each output is 1 referenced back to the input. The main job of this circuit seems to be to provide power gain (lower impedance output) as apposed to voltage gain, and to produce a differential signal to drive a small speaker with directly. This does actually give you a voltage gain of 2 accross the speaker relative to the input, but the main point is to be able to drive the speaker with ± the supply voltage. That is useful to put more power into the speaker from a low supply voltage.
If you want a preamp, make a preamp, and use parts intended for some voltage gain with good characteristics of noise, linearity, and distortion. This is not what the LM4871 is intended for, given the schematic you provided.
It sounds like you should either use an instrumentation amplifier or an audio transformer for taking the "Bridge" output and converting it to a single-ended ground referenced signal. An audio transformer is fairly obvious but note that you may need to have a decent load attached for the amplifiers to work correctly.
You may get lucky and not need a load and you may also find that the output on pin 8 (or 5) is perfectly adequate for your needs - to make single-ended and ground referenced you can try using a decoupling capacitor like 10uF and a 1k resistor to ground. It's worth a try.