At least 40 farmers have been killed in an attack by suspected Islamic militants in northeast Nigeria's Borno state, a government official says.