(I assume the ground field is an algebraically closed field of characteristic zero. It would have been useful to specify which field you have in mind.) Your condition amounts to asking whether there exists a invariant nondegenerate quadratic form, i.e. a nondegenerate bracket $\langle\cdot,\cdot\rangle$ satisfying
$$\langle x,[y,z]\rangle=\langle [x,y],z\rangle,\quad\forall x,y,z,$$
or equivalently such that the trilinear form $(x,y,z)\mapsto \langle x,[y,z]\rangle
$ is alternating. Such Lie algebras have several names in the literature, including "quadratic Lie algebras", "metric Lie algebras", "self-dual Lie algebras". (Beware that there is sometimes some ambiguity on whether this denotes a Lie algebra endowed with such a bilinear form, or a Lie algebra admitting at least such a form.) Anyway there is a lot of available information.

Here is now a few examples of Lie algebra with no such structure: the first two are based on the observation that, given a quadratic Lie algebra, the orthogonal of the derived subalgebra is necessarily equal to the center. Thus it is enough to find a finite-dimensional Lie algebra such that the dimension of the center and the codimension of the derived subalgebra do not coincide.

1) For instance, the 2-dimensional non-abelian Lie algebra cannot be made (non-degenerate) quadratic.

2) A nilpotent example is the Heisenberg Lie algebra with basis $(e_1,e_2,e_3)$ with $[e_1,e_2]=e_3$ and all other brackets zero: the derived subalgebra has codimension 2, while the center has dimension 1. More generally, if $d\ge 3$, if we consider the standard filiform Lie algebra with basis $(e_1,\dots e_d)$ with $[e_1,e_i]=e_{i+1}$ for $i=2\le i<d$ and all other brackets zero, the center has derived subalgebra has codimension 2 while the center has dimension 1. Also in the $(2m+1)$-dimensional Heisenberg algebra ($2m+1\ge 3$), the center and the derived subalgebra coincide and are 1-dimensional, so the codimension is $2m\neq 1$ and again there is no nondegenerate invariant bilinear form.

3) Also, here is a third counterexample, in which the above argument does not work (the Lie algebra is perfect and the center is zero): the semidirect product $\mathfrak{g}=\mathfrak{sl}_2\ltimes \mathfrak{v}$, where $\mathfrak{v}$ is a finite-dimensional irreducible representation of dimension $\neq 1,3$ (for instance, the standard 2-dimensional representation). Then the only ideals of $\mathfrak{g}$ are $\mathfrak{g}$, $\mathfrak{v}$ and $\{0\}$. But if there were a nondegenerate invariant quadratic form, the orthogonal of $\mathfrak{v}$ would be an ideal of the complementary dimension, which does not exist since $\dim(\mathfrak{v})\neq 3$.

In case you are working over an arbitrary field (e.g., the reals), you are asking whether there is a nondegenerate quadratic form which is in addition equivalent to the standard scalar product, but this is even more restrictive.