I do not know much about quaternion algebra, but I do know it is better to avoid involving the symbolic ring:
sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -1, -1)
sage: K.<x> = Q[]
sage: K
Univariate Polynomial Ring in x over Quaternion Algebra (-1, -1) with base ring Rational Field
The variable x
now lives in K:
sage: x.parent()
Univariate Polynomial Ring in x over Quaternion Algebra (-1, -1) with base ring Rational Field
and then:
sage: A = matrix(4,4,[0,j,0,j,j,0,0,j,0,0,0,0,j,j,0,0])
sage: I = matrix.identity(4)
sage: P = j*A - x*I
sage: P
[-x -1 0 -1]
[-1 -x 0 -1]
[ 0 0 -x 0]
[-1 -1 0 -x]
sage: P.parent()
Full MatrixSpace of 4 by 4 dense matrices over Univariate Polynomial Ring in x over Quaternion Algebra (-1, -1) with base ring Rational Field
sage: P.det()
x^4 - 3*x^2 + 2*x
What does "determinant" mean if the matrix is defined over a noncommutative ring? In your case you are lucky that
P.change_ring(SR).det()
makes sense, but that doesn't work in general.