It depends on $\mathcal{M}$ and on $X$. I take your question to ask whether there is a formula $\phi(x)$ without parameters such that whenever $\mathcal{N}$ has the same theory as $\mathcal{M}$, then $\mathcal{N}\models\phi(A)$ just in case $A\in X^{\mathcal{N}}$ and $A$ is not definable in $\mathcal{N}$.

First, let's describe how it can happen that $\mathcal{M}$ and $X$ admit no such formula $\varphi$. I mentioned this idea in a comment on your earlier question. Suppose that $\mathcal{M}$ is pointwise definable, so that every element of $\mathcal{M}$ is definable without parameters in $\mathcal{M}$, and suppose that $X$ is infinite (it is fine for it to be finite inside $\mathcal{M}$, as long as it is not finite in the meta-theory). In this case, I claim that there can be no such formula $\varphi$. The reason is that every element of $\mathcal{M}$ is definable, and so it must be that $\forall x\neg\varphi(x)$ is true in $\mathcal{M}$ and therefore part of the theory of $\mathcal{M}$. But meanwhile, since $X$ is infinite, there will be elementary extensions $\mathcal{M}\prec\mathcal{N}$ having new elements of $X$, which by elementarity must not be definable. So $\varphi$ will fail to hold of these new non-definable elements of $X$ in $\mathcal{N}$.-

Second, let's describe a positive example, a case for which there is such a formula $\varphi$. Suppose $\mathcal{M}$ does not satisfy $V=\text{HOD}$ and furthermore, that there are sets of reals in $\mathcal{M}$ outside of $\text{HOD}^\mathcal{M}$. This situation can be easily arranged by forcing. Let $X$ be the collection of sets of reals not in $\text{HOD}$. Our assumptions ensure that this is an infinite definable set, but no elements of $X$ are definable, since none are even in $\text{HOD}$, and this fact will be part of the theory of $\mathcal{M}$. So the collection of non-definable elements of $X$ is defined by membership in $X$ and the formula $x=x$, since all elements of $X$ are all non-definable.

The examples illustrate the following general solution.

**Theorem.** The following are equivalent for any first-order structure $\mathcal{M}$ and any definable set $X$ in $\mathcal{M}$.

The type of being a non-definable element of $X$ is principal over $\text{Th}(\mathcal{M})$.

The collection of elements of $X$ that are definable in $\mathcal{M}$ is finite. (That is, finite in the meta-theory, considered externally to $\mathcal{M}$)

Proof. ($2\to 1$) If $a_0,\ldots,a_k$ are the definable elements of $X$ in $\mathcal{M}$, where $a_i$ is the unique satisfying instance in $\mathcal{M}$ of $\psi_i(a_i)$, then the non-definable elements of $X$ are exactly the satisfying instances $x$ of the formula: $x\in X\wedge \bigwedge_i\neg\psi_i(x)$. So in this case, the type is definable over the theory of $\mathcal{M}$.

($1\to 2$). Assume toward contradiction that $X$ has infinitely many definable elements in $\mathcal{M}$ and that the non-definability type is principal with the formula $\varphi(x)$, meaning that $\varphi(x)$ is true exactly of the non-definable elements of $X$ in any model elementarily equivalent to $\mathcal{M}$. Consider the theory asserting the theory of $\mathcal{M}$ plus $c\in X\wedge\neg\varphi(c)$ plus $\neg\psi(c)$, where $\psi$ is any formula defining an element of $X$ in $\mathcal{M}$. This theory is consistent, since any finite subset of the theory can be realized in $\mathcal{M}$. Thus, it has a model $\mathcal{N}$. But this model has the object $c$, which is in $X$ and does not satisfy the definition of any definable element of $X$, but also fails $\varphi$. So $c$ is not definable and fails $\varphi$, contradicting our assumption on $\varphi$. QED

So this is a general model-theoretic fact having nothing to do with models of set theory or sets of reals.