How to find the index of a facet of a boundary mesh region closest to a given point?

Naive solution:

Catch[If[RegionMember[MeshPrimitives[a, #], pt], Throw[#]] & /@ 
  MeshCellIndex[a, 2]]

{2, 20}


You can use the built-in (undocumented) function Region`Mesh`MeshNearestCellIndex:

nearestcellindex = Region`Mesh`MeshNearestCellIndex[a, testpoint]
{2, 20}
np = RegionNearest[a, testpoint];

Show[{HighlightMesh[a, 
   Style[nearestcellindex, Orange, Opacity[0.5]], 
   PlotTheme -> "Lines"], 
  Graphics3D[{Red, PointSize[Large], Point[testpoint], 
    Purple, Point @ np, 
    Black, Dashed, Line[{testpoint, np} ]}]}]

enter image description here