The Pentax FA35 f/2 might be lens you're looking for if you can find one. They're discontinued, but I see them fairly frequently in our forum marketplace.
It's not a pancake, but it's smaller than the FA31 and Sigma 30 f/1.4 (I think.).
It's sharp at wide open, and reportedly very sharp when you stop it down.
On the k-x, it will approximate the 50 mm normal view.
The FA28 f/2.8 is also reportedly pretty solid. It's small and in the focal length department you're looking for. Unfortunately I see that lens available used even less than the FA35.
Update:
Quote: I prefer a range of between 25 and 30mm. The 35mm and 40mm are a little too close for my liking to be honest.
I reread this part and saw that the FA35 probably won't be good after all. If you like that focal range, the DA15 f/4 might be another lens that would work for you.