No mere human can be expected to know everything, even in a domain where they are an expert (as consultants usually are). An essential skill for a high performing consultant is the ability to learn, understand, and apply new information in their domain quickly and effectively. In other words, when a company hires a consultant, they're not just hiring someone who literally "knows everything" - they're hiring someone who can rapidly understand problems and help them apply solutions. Further - if you were somehow able to know everything in your domain as of this moment in time, you'd probably be outdated tomorrow - so, again, you need to know how to learn.
So - while you don't want to give the impression that you don't know anything, it's okay to indicate that there are things you haven't yet mastered or aren't familiar with. The is, "I don't know" is a terrible answer, as you've guessed, because it doesn't really communicate any meaningful resolution and it leaves the clients feeling empty-handed.
While you want to remain honest about things you're unsure of, you do want to communicate some degree of action or a path to resolve the gap. Something like,
I'm not sure how X applies to Y, but I can get so-and-so on the phone who's our in-house Y expert.
Can we plan on following up on that next week, after I've had a chance to review the data? I expect that I can show you A, B, and C once I've looked.
That's a good question, I haven't solved that problem before - but when I did X similar problem with another client, we tried Y. Let's plan out how we might try that here.
Let me show you the online documentation I usually reference when I need answers to questions like that
Of course, you want to make the answer relevant, but the goal is: have a plan to resolve the question, and communicate that plan to the client. This way, you're ultimately helping them solve their problem, while maintaining their confidence - despite your "gap" in knowledge.
And - of course - once you've communicated a plan, it's important to stay on top of things appropriately, which may include follow up emails, a meeting, or whatever would be typical for communicating status and updates with your client.