The information Jeremiah gave the officials was a lie (v. 26). He kept the king's real conversation a secret. Jeremiah wasn't obliged to answer the officials' questions just because he was asked. Likewise, we shouldn't feel obligated to answer inflammatory questions.
God calls us to be people of integrity and keep our word. He tells us to speak the truth in love (Ephesians 4:15). Yet there are times when the most loving thing to do is to keep information from people who don't need to know.
My mother has dementia and often asks questions but she doesn't understand the answers or becomes unnecessarily upset. The staff at the nursing home where she lives regularly keep information from her as an alternative to giving her sedatives. I have reluctantly learnt to do the same.
It was also a problem that Rahab had when the Israelites spies came to Jericho (Joshua 2:4-6). Rahab took a huge risk and told the king's messengers that they had left the city at dusk. Guards were sent on a pointless pursuit. However Rahab's decision to conceal their hiding place was richly rewarded by God.
Jesus told mourners that Jairus' daughter was asleep, not dead (8:52). After Jesus healed her, he ordered her parents not to tell anyone what had happened (v. 56). Jesus was effectively asking them to perpetuate the story that she slept.
Confidentiality is important. People need to be able to trust us to keep their legitimate confidences but, of course, not unlawful secrets. Sometimes, we need God's discernment to know the difference.