Missing values in k-Nearest Neighbours algorithm usually are handled according to the following criteria:
For nominal attributes:
if isMissingValue(a) or isMissingValue(b), then
distance = 1
For numeric attributes:
if isMissingValue(a) and isMissingValue(b), then
distance = 1
if isMissingValue(a) and !isMissingValue(b), then
distance = max(b, 1-b)
if !isMissingValue(a) and isMissingValue(b), then
distance = max(a, 1-a)
You can check the implementation in the source (link provided by Walter).