Given a system of $N$ point-particles with positions
${\bf r}_1, \ldots , {\bf r}_N$; with corresponding virtual displacements $\delta{\bf r}_1$, $\ldots $, $\delta{\bf r}_N$; with momenta ${\bf p}_1, \ldots , {\bf p}_N$; and with applied forces ${\bf F}_1^{(a)}, \ldots , {\bf F}_N^{(a)}$. Then D'Alembert's principle states that
$$\tag{1} \sum_{j=1}^N ( {\bf F}_j^{(a)} - \dot{\bf p}_j ) \cdot \delta {\bf r}_j~=~0. $$
The total force
$${\bf F}_j ~=~ {\bf F}_j^{(a)} +{\bf F}^{(ec)}_j+{\bf F}^{(ic)}_j
+ {\bf F}^{(i)}_j + {\bf F}_j^{(o)}$$
on the $j$'th particle can be divided into five types:
applied forces ${\bf F}_j^{(a)}$ (that we keep track of and that are not constraint forces).
an external constraint force ${\bf F}^{(ec)}_j$ from the environment.
an internal constraint force ${\bf F}^{(ic)}_j$ from the $N-1$ other particles.
an internal force ${\bf F}^{(i)}_j$ (that is not an applied or a constraint force of type 1 or 3, respectively) from the $N-1$ other particles.
Other forces ${\bf F}_j^{(o)}$ not already included in type 1, 2, 3 and 4.
Because of Newton's 2nd law ${\bf F}_j= \dot{\bf p}_j$, D'Alembert's principle (1) is equivalent to$^1$
$$\tag{2} \sum_{j=1}^N ( {\bf F}^{(ec)}_j+{\bf F}^{(ic)}_j+{\bf F}^{(i)}_j+{\bf F}_j^{(o)}) \cdot \delta {\bf r}_j~=~0. $$
So OP's question can essentially be rephrased as
Are there examples in classical mechanics where eq. (2) fails?
Eq. (2) could trivially fail, if we have forces ${\bf F}_j^{(o)}$ of type 5, e.g. sliding friction, that we (for some reason) don't count as applied forces of type 1.
However, OP asks specifically about internal forces.
For a rigid body, to exclude pairwise contributions of type 3, one needs the strong Newton's 3rd law, cf. this Phys.SE answer. So if these forces fail to be collinear, this could lead to violation of eq. (2).
For internal forces of type 4, there is in general no reason that they should respect eq. (2).
Example: Consider a system of two point-masses connected by an ideal spring. This system has no constraints, so there are no restrictions to the class of virtual displacements. It is easy to violate eq. (2) if we count the spring force as a type 4 force.
Reference:
H. Goldstein, Classical Mechanics, Chapter 1.
--
$^1$It is tempting to call eq. (2) the Principle of virtual work, but strictly speaking, the principle of virtual work is just D'Alembert's principle (1) for a static system.
Let us consider a non-relativistic Newtonian problem of $N$ point particles with positions
$$ {\bf r}_i(q,t), \qquad i\in\{1, \ldots, N\},\tag{1}$$
with generalized coordinates $q^1, \ldots, q^n$, and $m=3N-n$ holonomic constraints.
Let us for simplicity assume that the applied force of the system has generalized (possibly velocity-dependent) potential $U$. (This e.g. rules out friction forces proportional to the velocity.)
It is then possible to derive the following key identity
$$\begin{align}\sum_{i=1}^N \left({\bf F}_i-\dot{\bf p}_i\right)\cdot \left(\delta {\bf r}_i - \frac{\partial {\bf r}_i}{\partial t}\delta t\right)
~=~& \sum_{i=1}^N \left({\bf F}_i-\dot{\bf p}_i\right)\cdot \sum_{j=1}^n\frac{\partial {\bf r}_i}{\partial q^j}\delta q^j\cr
~=~& \sum_{j=1}^n \left(\frac{\partial L}{\partial q^j}-\frac{\mathrm d}{\mathrm dt} \frac{\partial L}{\partial \dot{q}^j} \right) \delta q^j,\end{align}
\tag{2} $$
where
$$ {\bf p}_i~=~m{\bf v}_i, \qquad {\bf v}_i~=~\dot{\bf r}_i, \qquad L~=~T-U,\qquad T~=~\frac{1}{2}\sum_{i=1}^Nm_i {\bf v}_i^2. \tag{3} $$
Here $\delta$ denotes an arbitrary infinitesimal$^1$ displacement in $q$s and $t$, which is consistent with the constraints. There are infinitely many such displacements $\delta$.
The actual displacement (i.e the one which is actually being realized)
is just one of those with $\delta t >0$.
In contrast, a virtual displacement $\delta$ has by definition
$$\delta t~=~0. \tag{4} $$
It is customary to refer to the time axis as horizontal, and the $q^j$ directions as vertical. Then we may say that a virtual displacement is vertical (4), while an actual displacement never is.
Note that both the lhs. and the rhs. of eq. (2) do effectively not depend on $\delta t$.
We can chose between the following first principles:
$$ \text{D'Alembert's principle } \Leftrightarrow \text{ Lagrange equations }\Leftrightarrow\text{ Stationary action principle}. \tag{5}
$$
I) On one hand, d'Alembert's principle says that
$$ \sum_{i=1}^N \left({\bf F}_i-\dot{\bf p}_i\right)\cdot \delta {\bf r}_i~=~0 \tag{6} $$
for all virtual displacements $\delta$ satisfying eq. (4).
This is equivalent to saying that the lhs. of eq. (2) vanishes for arbitrary (not necessarily vertical) displacements.
Then Lagrange equations
$$ \frac{\partial L}{\partial q^j}-\frac{\mathrm d}{\mathrm dt} \frac{\partial L}{\partial \dot{q}^j}~=~0\tag{7}
$$
follows via eq. (2) from the fact that the virtual displacements $\delta q^j$ in the generalized coordinates are un-constrained and arbitrary.
Conversely, when the Lagrange eqs. (7) are satisfied, then the lhs. of eq. (2) vanishes. This leads to d'Alembert's principle (6) for vertical displacements. It does not lead to d'Alembert's principle (6) for non-vertical displacements.
II) On the other hand, if we integrate the rhs. of eq. (2) over time $t$, we get (after discarding boundary terms) the infinitesimal virtual/vertical variation
$$ \delta S ~=~ \int \! \mathrm dt \sum_{j=1}^n \left(\frac{\partial L}{\partial q^j}-\frac{\mathrm d}{\mathrm dt} \frac{\partial L}{\partial \dot{q}^j} \right) \delta q^j\tag{8}$$
of the action $S= \int \!\mathrm dt~L$. The principle of stationary action then yields Euler-Lagrange equations (7).
III) Finally let us stress the following points:
Note in both case (I) and (II) that the freedom to perform arbitrary virtual displacements or virtual variations is what allows us to deduce the Lagrange eqs. (7).
Note in both case (I) and (II) that the displacements are vertical (4), i.e. no horizontal variation $\delta t$.
References:
- H. Goldstein, Classical Mechanics, Chapter 1 and 2.
--
$^1$ All displacements and variations in this answer are implicitly assumed to be infinitesimal.
Best Answer
The problem is that you assume the system is in equilibrium in your first line. Apparently the pendulum is not in equilibrium if the dot product of gravity and motion is not zero.
But actually d'alembert principle states the following for general cases,
$$\sideset{}{}\sum_{i}(F_i-\dot{p})\cdot \delta x_i=0 $$ So we have $$\sideset{}{}\sum_{i}(F_{applied,i}+F_{constraint,i}-\dot{p})\cdot \delta x_i=0 $$ And we only consider the cases in which the contranint forces do not do work. So $$\sideset{}{}\sum_{i}F_{constraint,i}\cdot \delta x_i=0$$ And thus we have $$\sideset{}{}\sum_{i}(F_{applied,i}-\dot{p})\cdot \delta x_i=0$$
And this is the d'alembert principle.