In this paper we derive new upper bounds for the densities of measurable sets in R^n which avoid a finite set of prescribed distances. The new bounds come from the solution of a linear programming problem. We apply this method to obtain new upper bounds for measurable sets which avoid the unit distance in dimensions 2,..., 24. This gives new lower bounds for the measurable chromatic number in dimensions 3,..., 24. We apply it to get a new, short proof of a recent result of Bukh which in turn generalizes theorems of Furstenberg, Katznelson, Weiss and Bourgain and Falconer about sets avoiding many distances.