You can read the 18-50 review here:
Pentax 18-50mm and 18-55mm Kit Lens Comparison - Hands-on Reviews | PentaxForums.com
The 18-50, when retracted, is as small as the 21. The HD version is also very sharp. Its build is so-so. It is less versatile, being a prime.
The 21 is a true Limited, much less expensive than the 20-40 and, if you find the DA version used, produces wonderful starbursts.
The 20-40 is a fine lens, well built, quick to AF, beautiful optically. It's expensive though.
For a one-lens-fits-all, if your budget allows it, I'd say the 20-40 is probably the best choice. Otherwise, it depends on your style.