Exploiting hard filtered SQL Injections
websec.wordpress.com
websec.wordpress.com
Just use prepared statements, and make sure that anything that isn't parameterizable (table names, column sort orders, limits, offsets, etc) is hardcoded and/or typecast (for instance, keep a table of valid table names, and look them up from HTTP parameters).
I certainly worked with my share of developers with just enough brains to know they need to validate the input and might have done their own regex method to filter instead of relying on far simpler built-in methods. Prepared statements being the next step up.
I had some other reasons here, but that is almost certainly the dominant reason; it explains all the instances of it I've encountered.
(Understanding encoding: http://www.jerf.org/iri/post/2548 )
Edit: BTW, when I say a lot of people parrot "use prepared statements" without understanding, please note I am not accusing any other commenter in this thread. I am actually thinking of people I've encountered in real life who A: told me that but B: I have other reason to believe don't really understand why. In particular, I work a lot professionally in Perl, and the Perl culture has somehow managed to converge from top to bottom on prepared statements, and I will confidently be told to use prepared statements by people who will turn around and write the most trivial of XSS attacks by the bushel. (If you don't know the connection between those two things, see my link above.)
No.
You should absolutely use prepared statements, but don't kid yourself about their magic powers.
I do agree prepared statements are the way to go at least 90% of the time.