3. The function $f(x)$ defined on $\mathbf{R}$ is both an odd function and a periodic function. If the smallest positive period of $f(x)$ is $\pi$, and when $x \in\left[0, \frac{\pi}{2}\right)$, $f(x)=\sin x$, then the value of $f\left(\frac{8 \pi}{3}\right)$ is $(\quad)$.
(A) $\frac{\sqrt{3}}{2}$
(B) $-\frac{\sqrt{3}}{2}$
(C) $\frac{1}{2}$
(D) $-\frac{1}{2}$
3. B.

According to the given conditions, we have
$$
\begin{array}{l}
f\left(\frac{8 \pi}{3}\right)=f\left(-\frac{\pi}{3}+3 \pi\right)=f\left(-\frac{\pi}{3}\right) \\
=-f\left(\frac{\pi}{3}\right)=-\sin \frac{\pi}{3}=-\frac{\sqrt{3}}{2}
\end{array}
$$