The thing is if you're a bit smart and know how to code, there's very little you probably can't do. The question is how long will it take you to figure out how to do it. You will much more likely be wondering whether you are doing it right.
So now its a question usually of scheduling. When you start getting in doubt about your ability to deliver on time, thats the time to raise your concerns. Tell them you might need to bring someone else on, maybe you can do this on budget or maybe you might have to eat some hours for free. Again its not perfect but if I hired someone like you and they went that route - I'm pretty okay with that, and I'm going to respect your honesty. Also if you're setting schedule make sure you build some buffer time in, and try to avoid projects with super hard and fast delivery dates.
Some people may flip out, but if you manage to keep them as close to on time and on budget as possible thats okay.
A third alternative is to reduce the scope to something you can finish. 37signals advocates compromising on scope but never on deadline, and I agree.
Any of those options would be fine. What's important is that you keep the client in the loop so that they can find another developer if they need to, before the project is 2 months late with no end in sight.
As a corollary, be upfront about your skillset, and don't take jobs you know you can't finish. As with anything, lying will bite you in the ass.
This lets me give a more realistic estimate for completion and cost. If the customer wants too much more or doesn't like my cost estimate, we're both better off knowing earlier than later.