The following is taken from these notes.
Definition 2.8. Let $\mathscr E$ be some cartesian closed category and let $A$ be an $R$-algebra. The spectrum $\operatorname{Spec}_A(R[x_1,\dots ,x_n]/I)$ of a finitely presented $R$-algebra $R[x_1,\dots ,x_n]/I$ is a subobject ('subset', naively speaking) of $A^n$, which consists of elements in $A^n$ annihalating the polynomials of $I$.
Examples:
- $\operatorname{Spec}_R(R[x])=R$
- $\operatorname{Spec}_R(R[\epsilon])= \left\{ d\in R\mid d^2=0 \right\}$
What is the relationship of these definition to the usual definition as the set/space of prime ideals? Aren't the 'elements annihalating polynomials' precisely the elements of the vanishing locus of $I$? What's the connection between the spectrum (space of prime ideals) and the vanishing locus of an ideal of polynomials?
Qiaochu's answer is quite right. Since you are asking the question in the context of synthetic differential geometry, let me add an remark. The key to resolving your question "What is the relationship of these definition to the usual definition as the set/space of prime ideals?" is to realize that one can interpret the definition given in your question internal to a given topos. In this way the definition will describe a specific object of the topos. From the external point of view this object deserves the name "spectrum".
For instance, let $\mathcal{E}$ be the big Zariski topos of a scheme $S$, that is the category of sheaves on the Grothendieck site $\mathrm{Sch}/S$. This category contains the functor of points of any $S$-scheme (and also the "functor of points" of more general, not locally affine, objects). An $\mathcal{O}_S$-algebra $\mathcal{A}$ posseses an internal mirror image in this topos, an $\mathbb{A}^1_S$-algebra $\mathcal{A'}$. The spectrum of $\mathcal{A'}$ as defined in your question will then coincide with the functor of points of the relative spectrum of $\mathcal{A}$ (as ordinarily studied in algebraic geometry). Details are in these notes, Section 13.1 ("Internal descriptions of basic constructions in relative scheme theory").
A similar statement can be made in the smooth setting. For instance, performing the construction given in your question internal to a suitable model of synthetic differential geometry based on $\mathcal{C}^\infty$-rings will yield the spectrum of an $\mathcal{C}^\infty$-ring from the external point of view.