I think the dnd rules are a little vague on this, perhaps intentionally. It does clearly state you fail a pickpocket if the target passes a perception check, but that doesnt mean every undetected attempt passes nor that you cannot steal when someone notices.
Call me when they patch out the Rootkit.
The publishers really murdered a top tier game with this ill will.