The
20-40 is my most used and currently my favorite lens.
I was looking at the Sigma
18-35, but then I came to realize that the
20-40 would see way more use because it is at a weight I wouldn't think twice about caring with me, (lighter than my
31mm) while the Sigma would be a chore for me to carry around.
The
20-40 has the best weight, and flare resistance out of the lenses you are looking at, it will also be compatible with continuous autofocus in video mode on Pentax's new cameras, (don't think the
16-50 will be, not sure about the
18-35 but probably not).
The
18-35 though not weather sealed would be best for
lowlight out of the lenses you're looking at, for
portraiture the
16-50, and for
street photography the
20-40.
Subjectively concerning boca I'd say the Sigma has the worst, the 20-40 has the best, but as being not as bright as the
16-50, (after about 24mm) the
16-50 might be better for, "boca centric" work.
Here's an example of the
20-40's boca:
Neighborhood-Fence by Download-Happy-Face on DeviantArt
But besides that the
20-40 was designed to try to capture
spatial presence, (I'm assuming nothing was lost in translation here) I found that very intriguing and thought that that may fit my photography style.
The Pentax 16-50 is meant to be a professional lens with a very useful zoom range, and some models, (particularly the earlier models) have problems with the autofocus giving out. The Sigma 18-35 is meant to be an engineering marvel, the first 1.8 zoom with great optical sharpness while still remaining affordable, at the expense of: weight, zoom range, a bit of flair and some boca issues, (a bit busy at times and sometimes large outlines around the boca circles).
Some specimens do exhibit erratic focusing on some Pentax bodies however. The 20-40 is meant to be light, and unique in its rendering, at the expense of zoom range, aperture size, and some sharpness. Some models, (particularly earlier models again) show low sharpness at some or multiple parts of the zoom range. Good copies of the lens should be sharp throughout the zoom range, so checking for decentering is advised.
Hope this was helpful and happy choosing