An operation with respect to which the set of prime numbers is closed Like every (semi-)decidable set of natural numbers the set $P$ of prime numbers is diophantine, i.e. there are two polynomials $p(x)$, $q$ with natural coefficients and exponents – the first of them containing a variable $x$ (next to other variables $\mathbf{n} = n_1, \dots ,n_k$), the second one eventually too (next to other variables $\mathbf{m} = m_1, \dots ,m_l$)– such that 
$$P = \lbrace x \in \mathbb{N}\ |\ (\exists \mathbf{n}, \mathbf{m})\ p(x) = q\ \rbrace$$
[Note that a polynomial with natural coefficients and exponents is nothing but a term in the language of Peano arithmetic.]
My question does not concern the definability of the set $P$ of prime numbers by polynomials but the existence of an operation with respect to which $P$ is closed:

Question: Is there a binary operation $\odot$ on the natural numbers
  – defined by a term in the language of Peano arithmetic with exactly two variables
  $x,y$ – such that 
$$ x,y \in P \rightarrow x \odot y \in P$$
i.e. the set $P$ of prime numbers is closed with respect to
  $\odot$?



*

*For the set $N\!P = \mathbb{N}\setminus P$ of non-prime numbers everything is obvious. As a diophantine set it is defined by the two polynomials $p(x) = x$ and $q = (n_1+2)\cdot(n_2+2)$. The natural binary operation $x \odot y$ with respect to which $N\!P$ is closed is $x\cdot y$ — expressing the fact that the product of two non-prime numbers is non-prime.

*For the set $P$ of prime numbers the defining polynomials/terms $p(x)$ and $q$ are not obvious at all: they are highly complex - having big or even huge orders and numbers of variables - and hard to find. So it is at first glance not obvious that there might be a binary operation $x \odot y$ (with respect to which $P$ is closed) that is simple - having a small order - and easy to find - or at all.  
 A: [There may be some details to make sure the following goes through, but I think it does provided the polynomial is really in two variables. But also maybe some special care is needed when the degree is small.]
Let $f(x,y)$ be a two variable polynomial of the desired type. Choose a fixed prime, e.g. $2$, then the one variable polynomial $p(x)=f(x,2)$ would have to be prime whenever $x$ is a prime. Next take some prime $a$ and evaluate $p(a)$, which is by assumption a prime. It is necessary here to assume that $p(a) \neq \pm a$ but that seems it would be easy to ensure. We now have $\gcd(a,p(a))=1.$ Now it is known from one of the standard proofs that no polynomial can represent only primes, that given what we have set up so far, $p(a)$ is a divisor of $p(kp(a)+a).$ Since the gcd is $1$ here, the inside $kp(a)+a$, $k=1,2,3...$ is an arithmetic progression satisfying the hypothesis of Dirichlet's theorem, and so a value of $k$ may be chosen so that it is a prime.
Overall then, we have that $f(kp(a)+a,2)$ is composite, being divisible by $p(a).$ (Or maybe the second entry $2$ is some other prime chosen at the start.)
About the choice of $p(x)$ (to ensure there is a prime $a$ for which $p(a)\neq a$):
Instead of using a fixed prime as one of the arguments, define $p(x)=f(x,x)$, which could be called the diagonal of the given $f(x,y)$ representing the binary operation. By the assumptions of the OP, all cooeficients of $f(x,y)$ are nonnegative integers. This means the only way one could have $p(x)=x$ (as a polynomial) would be if $f(x,y)=x$ or $f(x,y)=y$ (as polynomials). Any higher coefficients in $f(x,y)$ would produce higher coefficients in the diagonal polynomial $p(x),$ since the coefficients are all nonnegative. The OP is explicitly ruling the choices $f(x,y)=x,\ f(x,y)=y$ out, by the phrase "in exactly two variables". This phrase also rules out any constant polynomial such as $f(x,y)=17.$ So using this "diagonal" polynomial $p(x)=f(x,x)$ ensures that as a polynomial, $p(x)$ is neither $x$ nor a constant. To start out the argument above, we need a prime value a for which $p(a) \neq a.$ To ensure this, note that the poloynomial $p(x)-x$ has degree at least $1$ [since $p(x)$ is not the polynomial $x$]. So this last polynomial can have only a bounded number of zeros, and there being infinitely many primes to use for $a$ one can therefore find one for which $p(a)-a \neq 0,$ which gives the desired "starting point" $p(a) \neq a$ for the remainder of the argument given above.
