The fourth precept says we should be truthful. I think this means it's virtuous to truthfully admit to uncertainty when you don't know an answer, instead of pretending you do know or evading the question. Did the Buddha ever admit to not knowing something?
In the sutta quote below, the Buddha clearly states that he is not all-knowing.
There are some things that he knows and others that he may not know (yet).
Vaccha: “Sir, I have heard this: ‘The ascetic Gotama claims to be all-knowing and all-seeing, to know and see everything without exception, thus: “Knowledge and vision are constantly and continually present to me, while walking, standing, sleeping, and waking.”’ I trust that those who say this repeat what the Buddha has said, and do not misrepresent him with an untruth? Is their explanation in line with the teaching? Are there any legitimate grounds for rebuke and criticism?”
Buddha: “Vaccha, those who say this do not repeat what I have said. They misrepresent me with what is false and untrue.”
Vaccha: “So how should we answer so as to repeat what the Buddha has said, and not misrepresent him with an untruth? How should we explain in line with his teaching, with no legitimate grounds for rebuke and criticism?”
Buddha: “‘The ascetic Gotama has the three knowledges.’ Answering like this you would repeat what I have said, and not misrepresent me with an untruth. You would explain in line with my teaching, and there would be no legitimate grounds for rebuke and criticism.
Also, please see this answer.
To not knowing something? Buddha? A "handful of leaves" appear to say Buddha only revealed a handful of leaves of an entire forest of leaves he knew of. And that handful, only related to how suffering/discontent originated, and how it could be halted, primarily. I imagine the 45 years of his dispensation was too short and too precious, to be spent on anything else? Regards
There are famously some topics that are "undeclared" i.e. questions to which the Buddha did not declare an answer.
There's an introduction here -- Introduction to the Avyakata Samyutta (Undeclared-connected) by Thanissaro Bhikkhu -- which categorizes the questions and reasons why they're unanswered.
They're summarised i.e. just briefly listed on Wikipedia -- The unanswered questions.
Ironically this doesn't answer your question -- i.e. "Did the Buddha ever say, 'I don't know'?" -- but I hope this reference (to what he did say) is closely-related enough, to be on-topic and of interest to you.