A Shaliach for an Aveira
The gemara in Kiddushin (42b-43a) presents an exception to the generally ubiquitous halakha of shelichut. Though most areas of halakha allow for the appointment of a shaliach ("shelucho shel adam ke-moto"), an agent cannot be appointed to violate an aveira - "ein shaliach le-devar aveira." If Reuven requests from Shimon to perform an aveira, Shimon the shaliach, is culpable, and not Reuven.
The gemara poses two different reasons for this rule. Initially, the gemara (42b) claims that shelichut for an aveira fails based on pure logic. The gemara asserts, "divrei ha-rav ve-divrei ha-talmid divrei mi shom'in" - when given a choice to either listen to the "Master" or "Rebbe" (i.e. Hashem, and abstain from commiting the sin), or listen to the "servant" or "pupil" (i.e. the human being who requested the performance of the aveira), of course the shaliach should heed the words of the "Rebbe" and not commit the act. Tosafot in Bava Kama (79a) and Tosafot Ha-rosh in Bava Metzia (10b) amplify this concept by claiming that the meshaleiach probably was not serious when he originally lodged his request. Since he knows that the shaliach will probably not heed his words and violate Hashem's will, the meshaleiach could not possibly have been serious when delegating this agency. In effect, then, the entire mechanism of shelichut collapses since the appointment was probably frivolous to begin with.
Ultimately, the gemara suggests more formal sources for the principle of ein shaliach le-devar aveira. The gemara notes two exceptions - me'ilah (stealing benefit from hekdesh) and either tevicha u-mekhira (selling or slaughtering a stolen item, obligating payment of either four or five times the original value) or shelichut yad (a watchman who betrays his office and benefits from the item deposited with him). In these cases, shelichut does succeed in transferring liability for the action to the 'sender' even though his shaliach executed the physical act. In these instances, shelichut operates effectively. However, anytime the Torah states a principle only twice, we may infer that it does not apply universally. By iterating shelichut for aveira in these two cases, the Torah implies its non-application elsewhere (known as the principle of "shetei ketuvim ha-ba'in ke-echad ein me-lamdin"). Alternatively, the gemara suggests a pasuk in Vayikra (16) as a source for ein shaliach le-devar aveira: "dam yeichasheiv la-ish ha-hu" (the aveira of sacrificing an animal outside the Mikdash will cause penalty to the person who actually offered the displaced korban). By stressing that the person who actually performed the sacrifice will suffer the consequences, the Torah reminds us that shelichut does not obtain in the case of aveira. If a shaliach was dispatched to perform an aveira, he is culpable and not his sender. There is great debate as to whether, by citing these sources, the gemara is retreating from its earlier stated logic of "divrei ha-rav" or is merely elaborating upon that logic by finding corresponding pesukim. (See for example, the Penei Yehoshua in Kiddushin and Rabbi Akiva Eiger in his Derush ve-Chiddush to Bava Metzia.)
The source for the halakha disqualifying shelichut in instances of aveira might reflect a fundamental difference in the essence of the halakha. Assuming the logic of "divrei ha-rav," we might view the entire shelichut as being canceled. If the meshaleiach had no reason to assume his shaliach would actually perform the agency, he wasn't serious in appointing him and the proxy is canceled. If, however, the Torah is only formally excluding acts of aveira from the process of shelichut, we might claim that indeed the shaliach remains a representative but his act of aveira in no way 'transfers' to the meshaleiach and the shaliach remains responsible. The consequence of this question might be whether the act performed by the shaliach has any validity. For example, if Reuven appoints Shimon to be mekadesh a woman who is forbidden to him, unquestionably the shaliach has violated the issur and not the meshaleiach, due to ein shaliach le-devar aveira. But is the kiddushin binding? Does this principle mandate that the aveira doesn't 'transfer,' or that the entire shelichut fails? This question is debated by Tosafot in Bava Metzia (10b) s.v. de-amar and probably stems from our initial question. The logic of "divrei ha-rav" would probably cancel shelichut entirely, while a formal disqualification would only impede the transfer of the aveira while leaving the institution of shelichut intact.
The Rema (Choshen Mishpat 388) cites the view of the Tashbaz that if the shaliach was a known violator of halakha the shelichut is viable. After all, the cancellation of shelichut is based upon "divrei ha-rav" and the consequent expectation that the shaliach will refrain from executing the aveira. A hardened violator of halakha, however, will probably fulfill his mission, and hence the shelichut is valid. The Shakh disagrees with the Rema, as he views the pesukim, rather than the logic, as the basis for the cancellation of the shelichut.