Many production processes yield both good outputs and undesirable ones (e.g., pollutants). In this article we develop a generalization of a stochastic frontier model that is appropriate for such technologies. We discuss efficiency analysis and, in particular, define technical and environmental efficiency in the context of our model. We develop methods for carrying out Bayesian inference and apply them to a panel data set of Dutch dairy farms, where excess nitrogen production constitutes an important environmental problem.