The torah commands us to distance from a false thing. I would like to know if any halachic authorities have discussed whether or not this commandment may be put aside when dealing with a terminally ill child (or a similar situation) where one may wish to lie in order to provide comfort to the sick person.
The Shulchan Arukh (YD 337) writes:
חולה שמת לו מת -- אין מודיעין אותו, שמא תטרף דעתו עליו. ואין קורעין חלוקו, ואין בוכין, ואין מספידין בפניו שלא ישבר לבו. ומשתיקין את המנחמין מפניו.
A sick person whose relative died -- we don't inform him lest he lose his mind. And we don't rip his clothing nor cry nor eulogize in front of him so his heart won't break. And we silence comforters in front of him. (my translation)
So yes we do lie if we expect the anguish might be dangerous to his health.
We even forgo the sick person's saying Kaddish for his now deceased parent (because he doesn't know to) or the honor of the deceased (by moving the body and comforters elsewhere) if need be since danger to life (Pikuach Nefesh) trumps all (Arukh haShulchan ibid.).