Whose neighbours are hostile? Introduction

For the purposes of this challenge, we will define the neighbours of an element \$E\$ in a square matrix \$A\$ (such that \$E=A_{i,j}\$) as all the entries of \$A\$  that are immediately adjacent diagonally, horizontally or vertically to \$E\$ (i.e. they "surround" \$E\$, without wrapping around).

For pedants, a formal definition of the neighbours of \$A_{i,\:j}\$ for an \$n\times n\$ matix \$A\$ is (0-indexed):
$$N_{i,\:j}=\{A_{a,\:b}\mid(a,b)\in E_{i,\:j}\:\cap\:([0,\:n)\:\cap\:\Bbb{Z})^2\}$$
where
$$E_{i,\:j}=\{i-1,\:i,\:i+1\}\times \{j-1,\:j,\:j+1\} \text{ \\ } \{i,\:j\}$$

Let's say that the element at index \$i,\:j\$ lives in hostility if it is coprime to all its neighbours (that is, \$\gcd(A_{i,\:j},\:n)=1\:\forall\:n\in N_{i,\:j}\$). Sadly, this poor entry can't borrow even a cup of sugar from its rude nearby residents...

Task

Enough stories: Given a square matrix \$M\$ of positive integers, output one of the following:


A flat list of elements (deduplicated or not) indicating all entries that occupy some indices \$i,j\$ in \$M\$ such that the neighbours \$N_{i,\:j}\$ are hostile.
A boolean matrix with \$1\$s at positions where the neighbours are hostile and \$0\$ otherwise (you can choose any other consistent values in place of \$0\$ and \$1\$).
The list of pairs of indices \$i,\:j\$ that represent hostile neighbourhoods.


Reference Implementation in Physica – supports Python syntax as well for I/O. You can take input and provide output through any standard method and in any reasonable format, while taking note that these loopholes are forbidden by default. This is code-golf, so the shortest code in bytes (in every language) wins!

Moreover, you can take the matrix size as input too and additionally can take the matrix as a flat list since it will always be square.

Example

Consider the following matrix:

$$\left(\begin{matrix}
64 &amp; 10 &amp; 14 \\
27 &amp; 22 &amp; 32 \\
53 &amp; 58 &amp; 36 \\
\end{matrix}\right)$$

The corresponding neighbours of each element are:

i j – E  -&gt; Neighbours                          | All coprime to E?
                                                |
0 0 – 64 -&gt; {10; 27; 22}                        | False
0 1 – 10 -&gt; {64; 14; 27; 22; 32}                | False
0 2 – 14 -&gt; {10; 22; 32}                        | False
1 0 – 27 -&gt; {64; 10; 22; 53; 58}                | True
1 1 – 22 -&gt; {64; 10; 14; 27; 32; 53; 58; 36}    | False
1 2 – 32 -&gt; {10; 14; 22; 58; 36}                | False
2 0 – 53 -&gt; {27; 22; 58}                        | True
2 1 – 58 -&gt; {27; 22; 32; 53; 36}                | False
2 2 – 36 -&gt; {22; 32; 58}                        | False


And thus the output must be one of the following:


{27; 53}
{{0; 0; 0}; {1; 0; 0}; {1; 0; 0}}
{(1; 0); (2; 0)}


Test cases

Input –&gt; Version 1 | Version 2 | Version 3

[[36, 94], [24, 69]] -&gt;
    []
    [[0, 0], [0, 0]]
    []
[[38, 77, 11], [17, 51, 32], [66, 78, 19]] –&gt;
    [38, 19]
    [[1, 0, 0], [0, 0, 0], [0, 0, 1]]
    [(0, 0), (2, 2)]
[[64, 10, 14], [27, 22, 32], [53, 58, 36]] -&gt;
    [27, 53]
    [[0, 0, 0], [1, 0, 0], [1, 0, 0]]
    [(1, 0), (2, 0)]
[[9, 9, 9], [9, 3, 9], [9, 9, 9]] -&gt;
    []
    [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
    []
[[1, 1, 1], [1, 1, 1], [1, 1, 1]] -&gt;
    [1, 1, 1, 1, 1, 1, 1, 1, 1] or [1]
    [[1, 1, 1], [1, 1, 1], [1, 1, 1]]
    [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]
[[35, 85, 30, 71], [10, 54, 55, 73], [80, 78, 47, 2], [33, 68, 62, 29]] -&gt;
    [71, 73, 47, 29]
    [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]
    [(0, 3), (1, 3), (2, 2), (3, 3)]
APL (Dyalog), 17 bytes
1=⊢∨(×/∘,↓)⌺3 3÷⊢

Try it online! (credits to ngn for translating the test cases to APL)
Brief explanation
(×/∘,↓)⌺3 3 gets the product of each element with its neighbours.
Then I divide by the argument ÷⊢, so that each entry in the matrix has been mapped to the product of its neighbors.
Finally I take the gcd of the argument with this matrix ⊢∨, and check for equality with 1, 1=
Note, as with ngn's answer, this fails for some inputs due to a bug in the interpreter.