Your notion of a prime (i.e. non-composite) is generally known as an irreducible, indecomposable, or atom, i.e. an element of an integral domain $R$ having only "trivial" factorizations $\color{#c00}{{\rm in}\ R},\,$ i.e. if $\,p = ab,\ a,b\,\ \color{#c00}{{\rm in}\ R},\,$ then one factor is trivial (i.e. $1$ or a divisor of $1$, i.e. a unit = invertible $\color{#c00}{{\rm in}\ R}).\,$ Further atoms are assumed to be nonunits $\color{#c00}{{\rm in}\ R}.$ This definition does depend on the $\rm\color{#c00}{underlying}$ $\color{#c00}{\rm ring}$ since said factorizations and divisibilities depend on the multiplication table $\color{#c00}{{\rm of}\ R}$.

In particular, an atom $\,p\,$ need not remain an atom in an extension ring because its multiplication table may differ on such matters, e.g. we can always adjoin $\sqrt p$ to $R$ get a nontrivial factorization $\,p = \sqrt{p}\sqrt p\,$ by extending to $\,\bar R = R[x]/(x^2-p),\,$ i.e. $\,R[x]\bmod (x^2-p).\,$ In this quotient ring we have $\,p \equiv x^2\,$ and this factorization is nontrivial, i.e. $x$ is a nonunit in $\bar R,\,$ for otherwise $\, 1 \equiv x f(x)\pmod{\!x^2-p}$ for some $\,f\in R[x]\,$ so $\, 1 = xf(x) + (x^2-p) g(x),\,$ so evaluation at $\,x=0\,$ yields $\, 1= -p\:\!g(0)\,$ in $R$, so $\,p\mid 1\,$ in $R$, contra $p$ is an atom in $R$ so not a unit in $R$.

$p$ can also fail to persist as an atom in an extension ring if it becomes a unit, e.g. we can adjoin its inverse by passing to $R[x]/(px\!-\!1);\,$ e.g. as you note, $3$ becomes a unit when extending $\Bbb Z$ to $\Bbb R$.

Like atoms, by convention composites (nonatoms) are also usually assumed to be nonunits, so above the unit $3\in\Bbb R$ is neither an atom nor a composite.


(In more abstract contexts, the ones that you refer as "primes" are called "irreducible" elements).

You can define irreducible elements and divisibility in any set $S$ equipped with a binary operation $(S,\cdot)$ that satisfies the following properties:

1)Associative property.

2)Commutative property.

3)There is an identy element $1$.

4)$sk=sh\Rightarrow k=h$ (each element is cancellable)

This algebraic structure is called a commutative regular monoid.

In this setting you can say that given two elements $s_1,s_2 \in S$, $s_1$ divides $s_2$ if and only if there is a $k\in S$ such that:

$$s_2=ks_1=s_1k$$

(Notice that $ks_1=s_1k$ because of the commutativity of $\cdot$, otherwise you have to define divisibility on the left and on the right as two separate concepts).

An element $i\in S$ is called irreducible if and only if:

  1. Its only divisors are invertible elements and elements of the form $ui$ where $u$ is invertible.
  2. It's not invertible.

The first conditions is stated in this way because those divisors are unavoidable! In fact: $$i=(iu^{-1})u=(iu)u^{-1}$$ So we can't forbid divisors of this type. The second condition is stated as this because invertible elements have trivial divisibility properties(they divide any other element amd their only divisors are invertible elements), so it's not meaningful to talk about them.

Usually you use the word "irreducible" because "prime" has another meaning. In fact an element $p\in S$ is prime if and only if (it's not invertible and) when $p$ divides a product of two elements, it divides at least one of them(the intuitive meaning is that $p$ is an indivisible multiplicative block, so if it divides a products of two "buildings" it divides one of them and can't be splitted between the 2).

In general prime elements and irreducible elements are different concepts, but they coincide if in $(S,\cdot)$ each element has an "unique" factorization(for example they coincide in $\mathbb{Z}-\{0\},\mathbb{N}$).

In your case $(\mathbb{R}-\{0\},\cdot)$ is an abelian group so every element is invertible and no element is prime or irreducible.

In the comments they wrote about rings, and in fact usually these things are defined in rings(because having also a sum $+$ makes the structure richer in some sense, and allows to prove more things, even if it's not strictly necessary).