Once the king reaches the edge, park your queen on the next rank, safely away from the king. Now it is stuck on the edge for good.
8
7
6
5
4
3
2
1a
b
c
d
e
f
g
h