The closest match I can think of is a popular saying 人窮志不窮 (a man can run short on options, but can't run out of will and hope). The idea is along the same line as an old saying "a man can be destroyed, but he can't be defeated." This isn't exactly originated from Confucius, but it is still generally regarded as mainstream Confucian.
Another possible translation is 窮而不困 (maybe cornered, but never trapped), which is originated from 君子之學,非為通也,為窮而不困,憂而意不衰也 (the study of a great man is not [to aim] for passage, but [to prepare] for breaking free from a dead end, and for preventing one's will from withering during distress). This is a scripture from an unorthodox school of Confucianism.
Another possible translation is 窮而不困 (maybe cornered, but never trapped), which is originated from 君子之學,非為通也,為窮而不困,憂而意不衰也 (the study of a great man is not [to aim] for passage, but [to prepare] for breaking free from a dead end, and for preventing one's will from withering during distress). This is a scripture from an unorthodox school of Confucianism.