The first definition corresponds to maximal tori and should be used; the second corresponds to maximal split tori.
The answer by ಠ_ಠ correctly states the definition of Cartan subalgebras for general Lie algebras: It is a subalgebra that is nilpotent and its own normaliser. In the case at hand, it is useful to introduce the following concepts:
Let $\mathfrak{g}$ be a semisimple Lie algebra over any field of characteristic 0. A subalgebra of $\mathfrak{g}$ is called toral if it is abelian and consists of semisimple elements. It is called split toral if it is abelian and consists of diagonalisable elements.
(Of course this is made to resemble tori and split tori in the group setting; I will just write "(split) torus" occasionally.)
Now one has:
Lemma: For $\mathfrak{g}$ as above, a subalgebra is maximal toral iff it is a Cartan subalgebra (= self-normalising & nilpotent).
(This is e.g. exercise 3 to ch. VII $\S$ 2 in Bourbaki's Lie Groups and Lie Algebras.)
As long as one works over algebraically closed fields, one rarely hears of toral and split toral subalgebras, since by algebraic closedness, toral is the same as split toral ("every torus is split"), so that by the lemma:
For a subalgebra of a semisimple Lie algebra over $\mathbb{C}$,
maximal toral = maximal split toral = Cartan subalgebra.
But over other fields, in our case $\mathbb{R}$, we have distinct notions of
- maximal toral subalgebras, and
- maximal split toral subalgebras.
By the lemma, 1. corresponds to the first (Knapp's) definition you give, and the generally accepted notion of Cartan subalgebras.
The second usage that you describe corresponds to 2. That is, what they call a Cartan subalgebra there is actually a maximal split toral subalgebra (in the group setting, it would be a maximal split torus, as opposed to a maximal torus). I have not seen this usage myself and would advise against it, since it does not match the general definition of Cartan subalgebra. Also, it would make the notion not invariant under scalar extension. Calling $\mathfrak{a}_0$ a maximal split torus is much better.
As to your last question, even in split Lie algebras, i.e. when there exists a split maximal torus [Beware the order of words: this is a maximal torus which happens to be split; not, as in notion 2, a maximal one among the split tori], the second usage would be more restrictive, since there can still be maximal tori which are not split.
-- Example: $\mathfrak{g_0} = \mathfrak{sl}_2(\mathbb{R}) = \lbrace \pmatrix{a & b \\
c &-a } : a,b,c \in \mathbb{R}\rbrace$. Then the second usage sees the split Cartan subalgebras (= one-dimensional subspaces) in $\mathfrak{p}_0 = \pmatrix{a & b \\
b &-a }$, but misses the non-split one that constitutes $\mathfrak{k}_0$, $\pmatrix{0 & b \\
-b &0 }$. --
If $\mathfrak{g}_0$ is not split, notion 2 does not even give a subset of notion 1, but they are disjoint: The ones in notion 2 have dimension strictly less than those in notion 1. And $\mathfrak{g}_0$ can still be far from compact. As an example, the following 8-dimensional real Lie algebra is a matrix representation of the quasi-split form of type $A_2$:
$\mathfrak{g}_0 = \lbrace
\begin{pmatrix}
a+bi & c+di & ei\\
f+gi & -2bi & -c+di\\
hi & -f+gi & -a+bi
\end{pmatrix} : a, ..., h \in \mathbb{R} \rbrace$; according to the nomenclature here, one might call this $\mathfrak{su}_{1,2}$.
One has $\mathfrak{k}_0 = \begin{pmatrix}
bi & -f+gi & hi\\
f+gi & -2bi & f+gi\\
hi & -f+gi & bi
\end{pmatrix}$ (i.e. $a=0, c=-f, g=d, h=e$) and
$\mathfrak{p}_0 = \begin{pmatrix}
a & c+di & ei\\
c-di & 0 & -c+di\\
-ei & -c-di & -a
\end{pmatrix}$ (i.e. $b=0, c=f, g =-d, h=-e$).
The maximal split tori $\mathfrak{a}_0$ in this case are the one-dimensional subspaces of $\mathfrak{p}_0$. But one can compute how each of them has a non-trivial centraliser in $\mathfrak{k}_0$ which has to be added to get a maximal torus = Cartan subalgebra in the generally accepted sense; the most obvious choice being
$\mathfrak{a}_0 = \begin{pmatrix}
a & 0 & 0\\
0 & 0 & 0\\
0 & 0 & -a
\end{pmatrix}$ which demands $\mathfrak{t}_0 = \begin{pmatrix}
bi & 0 & 0\\
0 & -2bi & 0\\
0 & 0 & bi
\end{pmatrix}$ as a complement, so that $\mathfrak{a}_0 \oplus \mathfrak{t}_0$ is a maximal torus and becomes the standard maximal split = split maximal torus in the complexification $\mathfrak{g}_{0}^\mathbb{C} \simeq \mathfrak{sl}_3(\mathbb{C})$.
Best Answer
No such ideal exists.
A simple Lie algebra $\mathfrak{g}$ over a field $k$ is called absolutely simple if for every algebraic extension $K\vert k$ (or equivalently: for an algebraic closure $K\vert k$) , the scalar extension $K\otimes \mathfrak{g}$ is also simple (note that it necessarily is semisimple; for an example where it is not simple, see below).
One can show that if a Lie algebra over a field $k$ is simple but not absolutely simple, it is the scalar restriction of an absolutely simple Lie algebra over some algebraic extension $K \vert k$. Actually, one can compute $K$ as the (associative) subalgebra of $End_k(\mathfrak{g})$ consisting of those elements that commute with all $ad_\mathfrak{g}(x), x \in \mathfrak{g}$. As far as I know, this was first shown by Jacobson in Duke Math. J., Volume 3, Number 3 (1937), 544-548, doi:10.1215/S0012-7094-37-00343-0, and holds for more general kinds of algebras. I wrote a little overview of that in section 4.1 of my thesis, a lot of it is now reproduced in this answer of mine.
Now to your question: Since scalar extension commutes with direct sums, and ideals of semisimple Lie algebras are direct summands, your question is equivalent to asking whether there exists a simple compact real Lie algebra $\mathfrak{g}$ which is not absolutely simple. But by the above theory, and the fact that the only proper algebraic extension of $\Bbb R$ is $\Bbb C$, the only simple but not absolutely simple real Lie algebras are: the simple complex Lie algebras considered as $\Bbb R$-algebras. The first example maybe being $\mathfrak{sl}_2(\Bbb C)$ viewed as a Lie algebra over $\Bbb R$ (six-dimensional); it is simple, but not absolutely simple, as its scalar extension $\Bbb C \otimes_{\Bbb R} \mathfrak{sl}_2(\Bbb C)$ actually is isomorphic to the sum of two copies of $\mathfrak{sl}_2(\Bbb C)$.
However, none of these scalar restrictions of simple complex Lie algebras correspond to compact Lie groups, e.g. because they obviously contain nilpotent elements.