The "X marks spot" on flag will be made along the diagonal of the flag. The shape of flag is square with each side 12 inches long. The diagonals of a square are equal in length. So the inches of ribbon needed to make the mark will be 2 times the length of a diagonal.
The length of diagonal of square with side 12 inches will be:

The length of one diagonal is 16.97 inches. The length of 2 diagonals will be 33.94 inches or approximately 34 inches.
Therefore, 34 inches of ribbon will be needed to make the mark X on a square shaped flag having a side length of 12 inches.