  In this paper we obtain the necessary condition for the existence of perfect
$k$-colorings (equitable $k$-partitions) in Hamming graphs $H(n,q)$, where
$q=2,3,4$ and Doob graphs $D(m,n)$. As an application, we prove the
non-existence of extended perfect codes in $H(n,q)$, where $q=3,4$, $n>q+2$,
and in $D(m,n)$, where $2m+n>6$.
