I actually failed recently on a project. I can't really mention details due to Non-disclosure agreements, but I was working on a project involving Google and I simply couldn't finish. I wasn't smart enough. It involved encryption that was just beyond my scope of knowledge.
I have never had to walk away from a project before, never had to tell someone I couldn't complete a task. It was such a strange feeling. I couldn't even do enough research to figure out how to go about passing the road block. I know that I don't know everything, but I never thought that I would run into a problem too complicated to even learn.