The negative sense was coming into the language in Shakespeare's time: indeed, Shakespeare is the first recorded user in the Oxford English Dictionary, when Lucio talks of "the sanctimonious pirate, that went to sea with the Ten Commandments, but scraped one (ie thieving) out of the table" (Measure for Measure, I.ii.8).
However, his only other use of the word has no such negative connotations, and we must be careful not to read them in when Prospero warns Ferdinand that he must have no intercourse with Miranda "before All sanctimonious ceremonies may... be ministered" (The Tempest, IV.i.16). Here, the word means "holy, sacred, consecrated". It is closely connected with sanctimony, which had only religious senses: "sanctity, holiness", as when Troilus observes Cressida and says "If vows are sanctimony, If sanctimony be the gods'
delight ... This is not she" (Troilus and Cressida, V.ii.142), and "sacred bond, religious commitment", as when Iago says "If sanctimony and a frail vow ... be not too hard for my wits" (Othello, I.iii.350).